pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15910: Valgrind-detected error in DecodeTimeOnly
Date: Tue, 16 Jul 2019 19:24:56 +0300
Message-ID: <0aaf1cb9-0f85-e786-fb32-b3d68b80d027@gmail.com> (raw)
In-Reply-To: <15910-2eba5106b9aa0c61@postgresql.org>
References: <15910-2eba5106b9aa0c61@postgresql.org>

> Bug reference:      15910
> Logged by:          Alexander Lakhin
> Email address:      exclusion@gmail.com
> PostgreSQL version: 12beta2
> Operating system:   Ubuntu 18.04
> Description:        
>
> When executing the following query:
> SELECT time with time zone '04:05:06 m2';
> I get a strange result:
>       timetz
> -------------------
>  04:05:06+02:30:17
> and the valgrind errors:
> ==00:00:00:07.177 31724== Conditional jump or move depends on uninitialised
> value(s)
> ==00:00:00:07.177 31724==    at 0x57333D: DetermineTimeZoneOffsetInternal
> (datetime.c:1485)
> ==00:00:00:07.177 31724==    by 0x573DA6: DetermineTimeZoneOffset
The attached patch fixes this issue.

Best regards,
Alexander

Attachments:

fix-DecodeTimeOnly.patch (text/x-patch, 842B) download diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 54ea69f7f1..0a13ec8492 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -2280,6 +2280,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf, GetCurrentDateTime(tmp); else { + /* a date has to be fully specified */ + if ((fmask & DTK_DATE_M) != DTK_DATE_M) + return DTERR_BAD_FORMAT; tmp->tm_year = tm->tm_year; tmp->tm_mon = tm->tm_mon; tmp->tm_mday = tm->tm_mday; @@ -2307,6 +2310,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf, GetCurrentDateTime(tmp); else { + /* a date has to be fully specified */ + if ((fmask & DTK_DATE_M) != DTK_DATE_M) + return DTERR_BAD_FORMAT; tmp->tm_year = tm->tm_year; tmp->tm_mon = tm->tm_mon; tmp->tm_mday = tm->tm_mday;

view thread (8+ messages)  latest in thread

Message-ID: <0aaf1cb9-0f85-e786-fb32-b3d68b80d027@gmail.com>
Permalink:  ../0aaf1cb9-0f85-e786-fb32-b3d68b80d027@gmail.com/
Also on:    postgresql.org/message-id/0aaf1cb9-0f85-e786-fb32-b3d68b80d027@gmail.com

 ·  · 

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: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15910: Valgrind-detected error in DecodeTimeOnly
  In-Reply-To: <0aaf1cb9-0f85-e786-fb32-b3d68b80d027@gmail.com>

* 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