another ecpg crash
От | Euler Taveira de Oliveira |
---|---|
Тема | another ecpg crash |
Дата | |
Msg-id | 48267B0E.1000005@timbira.com обсуждение исходный текст |
Ответы |
Re: another ecpg crash
Re: another ecpg crash |
Список | 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/ *** ./src/interfaces/ecpg/preproc/preproc.y.orig 2008-05-11 01:28:52.000000000 -0300 --- ./src/interfaces/ecpg/preproc/preproc.y 2008-05-11 01:43:24.000000000 -0300 *************** *** 90,96 **** ret_value = error_code; break; case ET_FATAL: ! fclose(yyin); fclose(yyout); if (unlink(output_filename) != 0 && *output_filename != '-') fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename); --- 90,98 ---- ret_value = error_code; break; case ET_FATAL: ! /* there are some cases (i.e. file not found) that the input is not available */ ! if (!yyin) ! fclose(yyin); fclose(yyout); if (unlink(output_filename) != 0 && *output_filename != '-') fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);
В списке pgsql-hackers по дате отправления: