From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Missing checks on return value of timestamp2tm in datetime.c |
Date: | 2015-06-30 12:57:07 |
Message-ID: | CAB7nPqRry0MD2tPfe_LGnW2c5cADkwjKeC_vuDkA7NoHmLdY9w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jun 30, 2015 at 9:45 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> timestamp2tm is called close to 40 times in the backend source code,
> returning -1 in case of failure. However, there are two places in datetime.c
> where we do not check for its return value: GetCurrentDateTime and
> GetCurrentTimeUsec.
> This does not really matter much in practice as the timestamp used is
> GetCurrentTransactionStartTimestamp(), but for correctness shouldn't we
> check for its return code and report ERRCODE_DATETIME_VALUE_OUT_OF_RANGE on
> error?
>
> Per se the patch attached.
And here is the patch.
(Thanks David R. for the poke).
--
Michael
Attachment | Content-Type | Size |
---|---|---|
20150630_datetime_checks.patch | text/x-patch | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-06-30 12:57:26 | Re: Unneeded NULL-pointer check in FreeSpaceMapTruncateRel |
Previous Message | Michael Paquier | 2015-06-30 12:53:07 | Unneeded NULL-pointer check in FreeSpaceMapTruncateRel |