Re: BUG #1440: ecpg seg faults

From: Edmund Bacon <ebacon(at)onesystem(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1440: ecpg seg faults
Date: 2005-01-24 20:17:11
Message-ID: 41F557C7.3000707@onesystem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

You know, I should have been able to think of that:

njamd says:

(gdb) set env LD_PRELOAD=libnjamd.so
(gdb) set env NJAMD_CHK_FREE=error
(gdb) r test_bad.pgc
Starting program:
/var/lib/pgsql/src/postgresql-8.0.0/src/interfaces/ecpg/preproc/ecpg
test_bad.pgc
NJAMD/free: Double free of address 0x41454ff4

Program received signal SIGSEGV, Segmentation fault.
0x4010a671 in kill () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4010a671 in kill () from /lib/i686/libc.so.6
#1 0x4010a405 in raise () from /lib/i686/libc.so.6
#2 0x4001f867 in __nj_underflow_free () from /usr/lib/libnjamd.so
#3 0x4001fe93 in __nj_overflow_free () from /usr/lib/libnjamd.so
#4 0x40021e87 in free () from /usr/lib/libnjamd.so
#5 0x0805755f in remove_typedefs (brace_level=1073902784) at variable.c:271
#6 0x08049e02 in yyparse () at preproc.y:610
#7 0x08055db0 in main (argc=2, argv=0xbfffe254) at ecpg.c:424
#8 0x400f7a67 in __libc_start_main () from /lib/i686/libc.so.6

Tom Lane wrote:

>Edmund Bacon <ebacon(at)onesystem(dot)com> writes:
>
>
>>According to the backtrace, it appears to be dieing in malloc.
>>
>>
>
>That's consistent with the idea that the multiple free is the source of
>trouble --- multiple free() could corrupt malloc's private data
>structures to the point of causing a crash in a later malloc call.
>
>The least painful way of locating the problem would be to relink ecpg
>with a debugging malloc package, which could tell you exactly where the
>bad free() call is. You'd probably want to rebuild with --enable-debug
>too.
>
> regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
>

--
Edmund Bacon <ebacon(at)onesystem(dot)com>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-01-24 20:24:13 Re: BUG #1440: ecpg seg faults
Previous Message Tom Lane 2005-01-24 20:03:37 Re: BUG #1440: ecpg seg faults