server crash in to_timestamp function

Поиск
Список
Период
Сортировка
От Ibrar Ahmed
Тема server crash in to_timestamp function
Дата
Msg-id 8494ccf60811110430p231714e1j54dacfd4cd7c1222@mail.gmail.com
обсуждение исходный текст
Ответы Re: server crash in to_timestamp function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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
whileprocessing 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
storedanywhere 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: Re: pg_upgrade project status
Следующее
От: Magnus Hagander
Дата:
Сообщение: Duplicated docs on libpq parameters