This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
0-size malloc in frame_init()
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: 0-size malloc in frame_init()
- From: "Kaido Karner" <kaido at tradenet dot ee>
- Date: Sat, 6 Oct 2001 21:04:41 +0200
- Cc: <briareos at lokigames dot com>
- Reply-To: <kaido at tradenet dot ee>
Hello!
trying to get a relatively big project to work with efence compiled in, we
found, that in some cases during throwing an exception the malloc with
size=0 is called. if I let efence to allow such call to succeed, the second
problem is faced - later the 0-byte allocation is tried to be freed.
I'm not sure if this is bug, but it's at least annoying. I have found
similar report from 1999, but without any responses (
http://gcc.gnu.org/ml/gcc-bugs/1999-10n/msg00571.html)
without e-fence attached it's working correctly.
we tried to isolate the problem into a separate test-program, and what came
out - all exceptions thrown generate such case, if there was a call to
OCIServerAttach() (this is part of the oracle client library) performed
before throwing an exception. as the oracle library does not have source, it
is unknown what exactly is the reason for that.
anyway, here is stack trace:
(gdb) run
Starting program: /home/svens/./a.out
[New Thread 1024 (LWP 5808)]
Electric Fence 2.2.0 Copyright (C) 1987-1999 Bruce Perens
<bruce@perens.com>
started ..
ElectricFence Aborting: Allocating 0 bytes, probably a bug.
Program received signal SIGILL, Illegal instruction.
[Switching to Thread 1024 (LWP 5808)]
0x400e9ff1 in kill () from /lib/libc.so.6
(gdb) bt
#0 0x400e9ff1 in kill () from /lib/libc.so.6
#1 0x400bae43 in do_abort () from /usr/lib/libefence.so.0
#2 0x400bb0cb in EF_Abortv () from /usr/lib/libefence.so.0
#3 0x400bb103 in EF_Abort () from /usr/lib/libefence.so.0
#4 0x400ba4ef in memalign () from /usr/lib/libefence.so.0
#5 0x400babc6 in malloc () from /usr/lib/libefence.so.0
#6 0x40095972 in frame_init () from /usr/lib/libstdc++-libc6.2-2.so.3
#7 0x40095a7d in find_fde () from /usr/lib/libstdc++-libc6.2-2.so.3
#8 0x400962d4 in __frame_state_for () from
/usr/lib/libstdc++-libc6.2-2.so.3
#9 0x4005b135 in __throw () from /usr/local/lib/libocicpp.so.0
#10 0x804a49b in main1 () at b.cpp:21
#11 0x804aa5c in main () at b.cpp:95
#12 0x400d9c5f in __libc_start_main () from /lib/libc.so.6
(gdb)
operating system is linux with kernel 2.2.18
gcc is 2.95.3
oracle client is 8.0.5.1
if someone cares to answer, please cc: kaido@tradenet.ee as I'm not in the
list.
with best regards,
kaido