1 Jan 2003 01:45
Re: Heads up: *possible* bug in cygwin
Charles Wilson <cwilson <at> ece.gatech.edu>
2003-01-01 00:45:28 GMT
2003-01-01 00:45:28 GMT
Christopher Faylor wrote: > On Tue, Dec 31, 2002 at 09:43:50AM -0500, Charles Wilson wrote: > >>Did gcc (pre 3.2) automatically initialize data to 0, while gcc-3.2 does >>not? Hmmm...waitaminute, I do have gcc2 installed... > > > If gcc/ld is not initializing static data to zero then there are some > pretty serious problems. Neither gcc, nor any other compiler that I > am aware of, is supposed to initialize automatic data to zero. You're right, as usual. (Plus empirical evidence: no change when compiling with gcc-2. Still get the SIGSEGV) You're also right [I think] about the buffer overrun/whatever problem in glib. I haven't found the specific, offending command yet, but it seems pretty obvious from the postmortem that that is what has happened. Single-stepping thru the code shows some interesting things. Basically, we have a g_string (structure that contains a char* field, a length field, plus some other fields that are hidden from the public interface. The whole structure is dynamically allocated, and the char* field points to additional dynamically allocation storage. This g_string is initially allocated as a minimum size string, where the char* points to a minimum size buffer (4 bytes, it appears), but contains "" (e.g. *char = '\0', len = 0). [as far as glib is concerned, the char* points to a chunk of memory 4 bytes long. But dlmalloc actually uses a chunk that is 16 bytes long == 3 32bit words of dlmalloc overhead, plus the user data](Continue reading)
RSS Feed