-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hrvoje Niksic wrote:
> "Hopkins, Scott" <[EMAIL PROTECTED]> writes:
> 
>> Interesting.  Compiled that code and I get the following when running
>> the resulting binary. 
>>
>>      /var/opt/prj/wget$ strdup_test
>>      20001448
> 
> As I suspected.  Such an obvious strdup bug would likely have been
> detected sooner.
> 
>> I appear to have a functioning wget binary with the strdup change to
>> config.h, but I'm curious what you think the other causes of this
>> problem could be.
> 
> Hard to tell.  Some crashes, especially those resulting from memory
> corruption bugs, can disappear when you change *anything* about the
> build.  Of course, they tend to reappear later as well.  If you're
> curious about debugging this, you can compile Wget with DEBUG_MALLOC
> defined, which will at least catch some obvious errors, such as double
> free.  Even better would be to run Wget under a real memory debugger
> such as valgrind or purify, but I don't know if you have access to one
> under AIX.

What does AIX's strlen() and strdup() do with NULL arguments, I wonder?
Can you check that out? It may be that strlen(NULL) graciously returns
0, and strdup() returns NULL, which would explain what we're seeing (but
not why NULL was passed.

Do you have gdb installed? If you wouldn't mind helping us track this
down a bit, it could be helpful to replace the "exit (1);" line in the
memfatal function, located in src/xmalloc.c, with "abort();". Then run
it (using the system's strdup(), and resource-limit settings that would
allow it to dump core); and run:

$ gdb path-to-wget corefile
...
(gdb) bt
...
(gdb) q

As Hrvoje said, running it under valgrind could also be very helpful.

You might also obtain more recent sources at
http://hg.addictivecode.org/ and see if the same problem exists (those
sources require recent versions of GNU Autoconf, Automake.

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHmVFi7M8hyUobTrERAlJWAJ9SHSE/mfnw7rSHM7Y122YYl1VkKQCfRTxm
50u/vtWXfka6D4KqttPP+hU=
=18ov
-----END PGP SIGNATURE-----

Reply via email to