Re: BUG #18614: [ECPG] out of bound in DecodeDateTime

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: p(dot)nekrasov(at)fobos-nt(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18614: [ECPG] out of bound in DecodeDateTime
Date: 2024-10-14 21:52:59
Message-ID: Zw2Su7kkYYF8nHQY@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Sep 12, 2024 at 08:54:42AM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18614
> Logged by: Pavel Nekrasov
> Email address: p(dot)nekrasov(at)fobos-nt(dot)ru
> PostgreSQL version: 17rc1
> Operating system: Alt 10
> Description:
>
> in the line ```if (tm->tm_mday < 1 || tm->tm_mday >
> day_tab[isleap(tm->tm_year)][tm->tm_mon - 1]) ``` tm->tm_mon may be equal to
> 0, which will result in reading by indexes -1
>
> this is possible when calling PGTYPESdate_from_asc or
> PGTYPEStimestamp_from_asc with "str" equal, for example, "AM95000062"

Yes, I agree. Attached is a non-word-wrapped patch that I plan to apply
to all supported PG versions.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

When a patient asks the doctor, "Am I going to die?", he means
"Am I going to die soon?"

Attachment Content-Type Size
ecpg.diff text/x-diff 768 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-10-14 21:58:58 BUG #18655: APT repository shell script doesn't work
Previous Message Tom Lane 2024-10-14 16:01:03 Re: BUG #18654: From fuzzystrmatch, levenshtein function with costs parameters produce incorrect results