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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to