This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/12127] gdb with python support still get crash on showing uninitialized local variables


https://sourceware.org/bugzilla/show_bug.cgi?id=12127

--- Comment #6 from asmwarrior <asmwarrior at gmail dot com> ---
OK, I think the pushed fix in Bug #16196
(https://sourceware.org/bugzilla/show_bug.cgi?id=16196#c2) should also fix this
bug.

Look at the crash report in comment 2, I have such backtrace:

#0  malloc_failure (size=2009291924) at ../../gdb/gdb/utils.c:1049
#1  0x00634f3a in xmalloc (size=2009291924)
    at ../../gdb/gdb/common/common-utils.c:53
#2  0x004e4bc7 in read_string (addr=2293384, len=2009291924, width=1,
    fetchlimit=200, byte_order=BFD_ENDIAN_LITTLE, buffer=0x298f584,
    bytes_read=0x298f588) at ../../gdb/gdb/valprint.c:1804
#3  0x004e66f8 in val_print_string (elttype=0x4bad438, encoding=0x0,
    addr=2293384, len=2009291924, stream=0x2ec2f68, options=0x298f5e4)
    at ../../gdb/gdb/valprint.c:2475
#4  0x0046ecfe in print_string_repr (printer=0x31075f8,
    hint=0x58a91e8 "string", stream=0x2ec2f68, recurse=1, options=0x298f9d4,
    language=0x7ee360 <cplus_language_defn>, gdbarch=0x2ebd520)
    at ../../gdb/gdb/python/py-prettyprint.c:336

The final reason is that xmalloc(size=2009291924) get a two large and random
size value.

My fix in comment 5 try to limit the size in function print_string_repr(),
which is located as 4th frame in the backtrace above.

The fix in Bug #16196 did a better job, because it limit the size in
read_string() function, which is second frame in the backtrace, so it fixed in
a lower level. Many other cases which call read_string() is fixed now.

I just build the current gdb git HEAD, and did some test again, GDB.exe did not
crash on showing un-initialized variables.

So, I personally think this bug is fixed now, what do you guys think?

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]