Re: BUG #16953: OOB access while converting "interval" to char

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: t.larionov@postgrespro.ru, pgsql-bugs@lists.postgresql.org
Date: 2021-04-08T11:37:21Z
Lists: pgsql-bugs
On Thu, Apr 08, 2021 at 07:04:03PM +0800, Julien Rouhaud wrote:
> 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.

Also, I guess that you'd just want to compile twice a modulo based on
MONTHS_PER_YEAR to get the correct positive position in each array.

> I'll just wait a bit to see if anyone else has any opinion on whether -1 month
> should be January or December.

Sure.  If you can send an updated patch, that would be great.
--
Michael

Commits

  1. Fix out-of-bound memory access for interval -> char conversion