GNOME Bugzilla – Bug 616098
[PATCH] fix access after free
Last modified: 2011-09-05 20:53:45 UTC
Created attachment 159008 [details] [review] fix access after free This patch fixes hundreds of valgrind warnings when parsing info pages, of the form: 413 errors in context 3 of 4: Invalid read of size 1 at 0x4027DAD: stpcpy (mc_replace_strmem.c:573) by 0x4B72382: g_stpcpy (in /lib/libglib-2.0.so.0.2400.0) by 0x4B72673: g_strconcat (in /lib/libglib-2.0.so.0.2400.0) by 0x807883B: info_process_text_notes (yelp-info-parser.c:1195) by 0x8077BD9: parse_tree_level (yelp-info-parser.c:851) by 0x8077C81: parse_tree_level (yelp-info-parser.c:866) by 0x8077D85: yelp_info_parser_parse_tree (yelp-info-parser.c:897) by 0x8075C56: info_process (yelp-info.c:392) by 0x4B79378: ??? (in /lib/libglib-2.0.so.0.2400.0) by 0x4DC8AB4: start_thread (in /lib/libpthread-2.11.1.so) by 0x500EDAD: clone (in /lib/libc-2.11.1.so) Address 0x55172c6 is 14 bytes inside a block of size 21 free'd at 0x40257F6: free (vg_replace_malloc.c:325) by 0x4B5A17C: g_free (in /lib/libglib-2.0.so.0.2400.0) by 0x8078821: info_process_text_notes (yelp-info-parser.c:1194) by 0x8077BD9: parse_tree_level (yelp-info-parser.c:851) by 0x8077C81: parse_tree_level (yelp-info-parser.c:866) by 0x8077D85: yelp_info_parser_parse_tree (yelp-info-parser.c:897) by 0x8075C56: info_process (yelp-info.c:392) by 0x4B79378: ??? (in /lib/libglib-2.0.so.0.2400.0) by 0x4DC8AB4: start_thread (in /lib/libpthread-2.11.1.so) by 0x500EDAD: clone (in /lib/libc-2.11.1.so) I don't think it fixes any user visible issue.
On Fedora 14 with glibc 2.13, the patch now fixes a crash when trying to open info docs.
Created attachment 184703 [details] [review] Fix access after free The same patch, but for git master, and untested.
backtrace from unpatched yelp 3.0.0 for "yelp info:bison" Program received signal SIGSEGV, Segmentation fault. (gdb) bt full
+ Trace 226846
I've now tested the second patch, it fixes the crash.
Created attachment 195246 [details] [review] Fix crash due to access after free The same patch, re-done against yelp master (3.1.2).
Pushed to master. Thanks.