Re: [BUGS] BUG #14582: ecpg crashes on SQL input

Поиск
Список
Период
Сортировка
От Euler Taveira
Тема Re: [BUGS] BUG #14582: ecpg crashes on SQL input
Дата
Msg-id CAHE3wghFXrHbJ+pkjkjLhVW=oGNLUhfuMPO3sb577ExkPUvORw@mail.gmail.com
обсуждение исходный текст
Ответ на [BUGS] BUG #14582: ecpg crashes on SQL input  (mdudley@gryphonsensors.com)
Список pgsql-bugs
2017-03-08 13:56 GMT-03:00 <mdudley@gryphonsensors.com>:
I have some SQL that crashes ecpg when I run:

$ cat test.sql | /usr/pgsql-9.6/bin/ecpg -o - -

I installed PostgreSQL from
"postgresql96-server-9.6.2-2PGDG.rhel7.x86_64.rpm".

There are trailing spaces on some lines in the SQL below--they are necessary
in order to reproduce the crash.

I reproduced the crash only with 9.6 and 9.5 (didn't try hard with other supported versions but they don't crash -- including HEAD) with the attached file extracted from your email (some email clients mangles your test). The crash seems to be related to the blank line in the middle of the above command (altough, few spaces doesn't crash the test). In a rapid test, a line with > 40 spaces produces the crash.
 
         INSERT INTO xxxxxxxx_xxxxxx_xxxxx(\
                                           xxxxxx_xx, \
                                           xxxx_xxxxxxxxxxxxx_xx, \
                                           xxxxxx_xxxxxxxxxxx_xxx_xx,\
                                           xxxxxxxxxxx_xx, \

xxxxxxxx_xxxxxxxx_xxxxxx_xxxxx_xx)\
             VALUES ( \
                      ( SELECT x_xx FROM xxxxxxx_xxxxxx LIMIT 1 ), \
                      ( SELECT xxxx_xxxxxxxxxxxxx_xx FROM xxxxxx LIMIT 1 ),

 The backtrace is:

(gdb) bt
#0  0x00007ff67829e067 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ff67829f448 in __GI_abort () at abort.c:89
#2  0x00007ff6782dc1b4 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7ff6783d1210 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ff6782e198e in malloc_printerr (action=1, str=0x7ff6783d13f8 "double free or corruption (fasttop)", ptr=<optimized out>) at malloc.c:4996
#4  0x00007ff6782e2696 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3840
#5  0x0000000000401a4d in cat2_str (str1=<optimized out>, str2=<optimized out>) at preproc.y:145
#6  0x0000000000401ad2 in cat_str (count=9) at preproc.y:162
#7  0x000000000040eb80 in base_yyparse () at preproc.y:6731
#8  0x0000000000403113 in main (argc=4, argv=0x7fff016f3ff8) at ecpg.c:452


--
   Euler Taveira                                   Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
Вложения

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

Предыдущее
От: "Dudley, Michael"
Дата:
Сообщение: Re: [BUGS] BUG #14582: ecpg crashes on SQL input
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: [BUGS] BUG #14582: ecpg crashes on SQL input