Re: BUG #16953: OOB access while converting "interval" to char
Julien Rouhaud <rjuju123@gmail.com>
From: Julien Rouhaud <rjuju123@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: t.larionov@postgrespro.ru, pgsql-bugs@lists.postgresql.org
Date: 2021-04-08T11:04:03Z
Lists: pgsql-bugs
On Thu, Apr 08, 2021 at 07:17:50PM +0900, Michael Paquier wrote: > On Wed, Apr 07, 2021 at 08:08:56PM +0800, Julien Rouhaud wrote: > > PFA a naive patch to fix this problem with some regression tests. I'm assuming > > that -1 month should be january and not december. I had a quick look at the > > rest of formatting.c and didn't spot any similar problem, but another pair of > > eyes wouldn't hurt. > > Assuming an absolute number is not really intuitive when it comes to a > negative number here, while counting backward feels more natural, so I > would vote for making -1 be December, -2 November, etc. Honestly I might as well have flipped a coin here, so I'm fine either way. > Let's also make the tests more extended. I would suggest a single > query with generate_series() from say -12 to 12, that checks the > output of both RM and rm for the full range of values supported by > tm_mon. I'm fine with it too, although I'd probably go with [-13, 13] just to make sure that there's isn't silly off-by-one mistake. I'll just wait a bit to see if anyone else has any opinion on whether -1 month should be January or December.
Commits
-
Fix out-of-bound memory access for interval -> char conversion
- 6540322fad8b 9.6.22 landed
- 1cc110f68dcc 10.17 landed
- 5656f2c3dce5 11.12 landed
- 82dd5706ee5a 12.7 landed
- be79debd9688 13.3 landed
- 7a3972597f6e 14.0 landed