Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > another ecpg cr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 9342 of 9770
Post > Topic >>

another ecpg crash

by euler@[EMAIL PROTECTED] (Euler Taveira de Oliveira) May 11, 2008 at 01:50 AM

This is a multi-part message in MIME format.
--------------080204050809090306040208
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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@[EMAIL PROTECTED]
 () 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/

--------------080204050809090306040208
Content-Type: text/x-patch;
 name="crash2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="crash2.diff"

*** ./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);

--------------080204050809090306040208
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


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

--------------080204050809090306040208--
 




 6 Posts in Topic:
another ecpg crash
euler@[EMAIL PROTECTED]   2008-05-11 01:50:22 
Re: another ecpg crash
alvherre@[EMAIL PROTECTED  2008-05-11 00:52:51 
Re: another ecpg crash
euler@[EMAIL PROTECTED]   2008-05-11 02:19:05 
Re: another ecpg crash
kleptog@[EMAIL PROTECTED]  2008-05-11 11:12:52 
Re: another ecpg crash
euler@[EMAIL PROTECTED]   2008-05-12 00:43:14 
Re: another ecpg crash
meskes@[EMAIL PROTECTED]   2008-05-12 18:33:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 4:42:20 CDT 2008.