Re: BUG #18614: [ECPG] out of bound in DecodeDateTime
Bruce Momjian <bruce@momjian.us>
From: Bruce Momjian <bruce@momjian.us>
To: p.nekrasov@fobos-nt.ru, pgsql-bugs@lists.postgresql.org
Date: 2024-10-14T21:52:59Z
Lists: pgsql-bugs
Attachments
- ecpg.diff (text/x-diff) patch
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.nekrasov@fobos-nt.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@momjian.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?"
Commits
-
ecpg: Fix out-of-bound read in DecodeDateTime()
- 9ecfd8a48adf 12.21 landed
- fcafbaadf7e5 13.17 landed
- 9a51d4af12a7 14.14 landed
- 335501fb2b80 15.9 landed
- a1e613b81aa0 16.5 landed
- 2c37cb26f8af 17.1 landed
- a0bff38d133a 18.0 landed