Thread
Commits
-
Detect more overflows in timestamp[tz]_pl_interval.
- e6e3ee5b7e23 15.7 landed
- cb0ccefa03d3 12.19 landed
- 440b6251b752 13.15 landed
- 4019285c0640 17.0 landed
- 3752e3d21028 16.3 landed
- 1748379b6361 14.12 landed
-
Fix overflow hazard in timestamp_pl_interval
Joseph Koshakow <koshy44@gmail.com> — 2024-04-28T02:59:44Z
Hi all, Attached is a patch that fixes some overflow/underflow hazards in `timestamp_pl_interval`. The microseconds overflow could produce incorrect result. The month overflow would generally still result in an error from the timestamp month field being too low, but it's still better to catch it early. I couldn't find any existing timestamp plus interval tests so I stuck a new tests in `timestamp.sql`. If there's a better place, then please let me know. Thanks, Joe Koshakow
-
Re: Fix overflow hazard in timestamp_pl_interval
Joseph Koshakow <koshy44@gmail.com> — 2024-04-28T03:19:52Z
Hi all, Immediately after sending this I realized that timestamptz suffers from the same problem. Attached is an updated patch that fixes timestamptz too. Thanks, Joe Koshakow On Sat, Apr 27, 2024 at 10:59 PM Joseph Koshakow <koshy44@gmail.com> wrote: > Hi all, > > Attached is a patch that fixes some overflow/underflow hazards in > `timestamp_pl_interval`. The microseconds overflow could produce > incorrect result. The month overflow would generally still result in an > error from the timestamp month field being too low, but it's still > better to catch it early. > > I couldn't find any existing timestamp plus interval tests so I stuck > a new tests in `timestamp.sql`. If there's a better place, then > please let me know. > > Thanks, > Joe Koshakow >
-
Re: Fix overflow hazard in timestamp_pl_interval
Tom Lane <tgl@sss.pgh.pa.us> — 2024-04-28T17:45:16Z
Joseph Koshakow <koshy44@gmail.com> writes: >> Attached is a patch that fixes some overflow/underflow hazards in >> `timestamp_pl_interval`. The microseconds overflow could produce >> incorrect result. The month overflow would generally still result in an >> error from the timestamp month field being too low, but it's still >> better to catch it early. Yeah. I had earlier concluded that we couldn't overflow here without triggering the range checks in tm2timestamp, but clearly that was too optimistic. >> I couldn't find any existing timestamp plus interval tests so I stuck >> a new tests in `timestamp.sql`. If there's a better place, then >> please let me know. They're in horology.sql, so I moved the tests there and pushed it. Thanks for the report! regards, tom lane