another ecpg crash

From: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, meskes(at)postgresql(dot)org
Subject: another ecpg crash
Date: 2008-05-11 04:50:22
Message-ID: 48267B0E.1000005@timbira.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I found another bug when using 'exec sql include filename'. If you use a
filename that doesn't exist, ecpg crashes while trying to close a null
pointer. The above test case shows it. A possible fix is attached.

#include <stdio.h>

/* foo.h doesn't exist */
exec sql include foo;

int main(void)
{
return 0;
}

(gdb) bt
#0 0xb7a746fd in fclose@@GLIBC_2.1 () from /lib/libc.so.6
#1 0x080496e1 in mmerror (error_code=2, type=ET_FATAL, error=0xb7eeb0cc
<Address 0xb7eeb0cc out of bounds>)
at /a/pgsql/dev/pgsql/src/interfaces/ecpg/preproc/preproc.y:93
#2 0x08069d07 in parse_include () at
/a/pgsql/dev/pgsql/src/interfaces/ecpg/preproc/pgc.l:1270
#3 0x08067fa7 in base_yylex () at
/a/pgsql/dev/pgsql/src/interfaces/ecpg/preproc/pgc.l:1080
#4 0x0806d4ce in filtered_base_yylex () at
/a/pgsql/dev/pgsql/src/interfaces/ecpg/preproc/parser.c:64
#5 0x0804a8a8 in base_yyparse () at y.tab.c:20322
#6 0x0806ca35 in main (argc=2, argv=0xbff0ea94) at
/a/pgsql/dev/pgsql/src/interfaces/ecpg/preproc/ecpg.c:462
(gdb) print yyin
$1 = (FILE *) 0x0

--
Euler Taveira de Oliveira
http://www.timbira.com/

Attachment Content-Type Size
crash2.diff text/x-patch 826 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-05-11 04:52:51 Re: another ecpg crash
Previous Message Tom Lane 2008-05-11 04:49:59 Re: bloated heapam.h