pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: t.larionov@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16953: OOB access while converting "interval" to char
Date: Thu, 8 Apr 2021 19:17:50 +0900
Message-ID: <YG7YTjuZXylrjGAv@paquier.xyz> (raw)
In-Reply-To: <20210407120856.3rjxxnnzzxn74vyv@nol>
References: <16953-f255a18f8c51f1d5@postgresql.org>
	<20210407120856.3rjxxnnzzxn74vyv@nol>

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.

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.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (9+ messages)  latest in thread

Message-ID: <YG7YTjuZXylrjGAv@paquier.xyz>
Permalink:  ../YG7YTjuZXylrjGAv@paquier.xyz/
Also on:    postgresql.org/message-id/YG7YTjuZXylrjGAv@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, rjuju123@gmail.com, t.larionov@postgrespro.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16953: OOB access while converting "interval" to char
  In-Reply-To: <YG7YTjuZXylrjGAv@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox