From: | "Ibrar Ahmed" <ibrar(dot)ahmad(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | server crash in to_timestamp function |
Date: | 2008-11-11 12:30:49 |
Message-ID: | 8494ccf60811110430p231714e1j54dacfd4cd7c1222@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
While looking at the code base I have encountered a server crash in
to_timestamp function.
select TO_TIMESTAMP ( '2006 1', 'YYYY Q' );
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
I further debugged the issue and here are my thoughts
[function DCH_from_char]
...
case DCH_Q:
/*
* We ignore Q when converting to date because it is not
* normative.
*
* We still parse the source string for an integer, but it
* isn't stored anywhere in 'out'.
*/
from_char_parse_int((int *) NULL, &s, n);
s += SKIP_THth(n->suffix);
...
This piece of code is calling function "from_char_parse_int" with
first argument NULL. The function "from_char_parse_int" in turn calls
"from_char_parse_int_len" which in turn calls "from_char_set_int".
In the function "from_char_set_int" the first argument "dest" is being
derefernced without the null check.
(if (*dest != 0 && *dest != value)
--
Ibrar Ahmed
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2008-11-11 12:45:19 | Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case) |
Previous Message | Zdenek Kotala | 2008-11-11 12:30:14 | Re: pg_upgrade project status |