Re: BUG #18614: [ECPG] out of bound in DecodeDateTime

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Bruce Momjian <bruce@momjian.us>
Cc: p.nekrasov@fobos-nt.ru, pgsql-bugs@lists.postgresql.org
Date: 2024-10-22T05:53:50Z
Lists: pgsql-bugs

Attachments

On Fri, Oct 18, 2024 at 02:51:32PM +0900, Michael Paquier wrote:
> It is not entirely the fault of this patch, because the same error is
> done a couple of lines above when using an incorrect hour number with
> timestamp_to_asc3.  The correct thing to do would be in the lines of
> what num_test2.pgc does with its check_errno(), I think where we'd
> check for the errno returned by PGTYPEStimestamp_from_asc() and
> printf() its information in the output of the test.  And we should do
> that for both the old timestamp_to_asc3 and your new timestamp_to_asc4
> if we want to be completely correct.

And here is what I had in mind, checking the error code on top of the
output.  The output is really optional, but that maps with 0 with the
offset applied, so I've just kept it.
--
Michael

Commits

  1. ecpg: Fix out-of-bound read in DecodeDateTime()