On Sun, Nov 25, 2012 at 07:46:42PM +0000, corvid wrote:
Jeremy's valgrind logs have had a couple of these recently, e.g., http://starurchin.org/dillo/valgrind/5b601af9ce7facc17690b88c4323c194fded01c...
I found that - after dpidc stop - valgrind --leak-check=full --trace-children=yes dillo - going to http://jimbojw.com/wiki/index.php?title=Data_URI_Explained - and pasting in the second example (the percent-encoded one, not the base64 one) gets me:
==20817== Invalid read of size 4 ==20817== at 0x804AED5: dStr_insert_l (dlib.c:287) ==20817== by 0x804AFB5: dStr_append_l (dlib.c:308) ==20817== by 0x8049317: main (datauri.c:332) ==20817== Address 0x41cbbb0 is 0 bytes after a block of size 664 alloc'd ==20817== at 0x402AE29: realloc (vg_replace_malloc.c:662) ==20817== by 0x804A736: dRealloc (dlib.c:53) ==20817== by 0x804918B: datauri_get_data (datauri.c:273) ==20817== by 0x80492E1: main (datauri.c:324) ==20817== ==20817== ==20817== Process terminating with default action of signal 11 (SIGSEGV): dumping core
Valgrind has options for debugging, but I haven't had any luck with getting them to work so far.
I'm imagining that this might have to do with only being able to send part of the data at a time when everything's sluggish due to valgrind, but I don't know datauri/dpip well enough to go straight for the most likely spots...
PS I don't trust the "by 0x8049317: main (datauri.c:332)" line because I have -O0, and sometimes it's had some 0x40... address instead that it describes as being below main.
Unfortunately I can't reproduce the problem here, but I see an issue in a_Url_decode_hex_str() (datauri.c): In line 154 two possibly unrelated pointers are subtracted. Could you try the following: diff -r 74833d000780 dpi/datauri.c --- a/dpi/datauri.couldThu Nov 15 23:09:50 2012 +0100 +++ b/dpi/datauri.couldSun Nov 25 21:52:22 2012 +0100 @@ -150,8 +150,8 @@ } *dest = 0; + *p_sz = (size_t)(dest - new_str); new_str = dRealloc(new_str, sizeof(char) * (dest - new_str + 1)); - *p_sz = (size_t)(dest - new_str); return new_str; } Cheers, Johannes