This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix ia64 segfault
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Thu, 28 Dec 2006 18:51:28 -0500
- Subject: [commit] Fix ia64 segfault
This bug was my fault, from the introduction of target_read_alloc.
ktab_size is a size_t, and thus unsigned; it was being assigned (LONGEST)-1
and then tested. Eventually this led to a NULL dereference.
Tested on ia64-linux and committed.
Just a reminder: the best thing you can do for any GDB port is test it
regularly! Until recently I had no convenient system on which I could test
ia64-linux GDB. I do now, but the results are dismal even after this patch.
powerpc64-linux is in pretty awful shape too.
--
Daniel Jacobowitz
CodeSourcery
2006-12-28 Daniel Jacobowitz <dan@codesourcery.com>
* ia64-tdep.c (get_kernel_table): Correct signedness in check
for a negative return value.
Index: gdb/ia64-tdep.c
===================================================================
RCS file: /scratch/gcc/repos/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.140
diff -u -p -r1.140 ia64-tdep.c
--- gdb/ia64-tdep.c 12 Jul 2006 18:13:45 -0000 1.140
+++ gdb/ia64-tdep.c 28 Dec 2006 20:24:25 -0000
@@ -2486,13 +2487,14 @@ get_kernel_table (unw_word_t ip, unw_dyn
if (!ktab)
{
gdb_byte *ktab_buf;
- size_t size;
+ LONGEST size;
- ktab_size = getunwind_table (&ktab_buf);
- if (ktab_size <= 0)
+ size = getunwind_table (&ktab_buf);
+ if (size <= 0)
return -UNW_ENOINFO;
- else
- ktab = (struct ia64_table_entry *) ktab_buf;
+
+ ktab = (struct ia64_table_entry *) ktab_buf;
+ ktab_size = size;
for (etab = ktab; etab->start_offset; ++etab)
etab->info_offset += KERNEL_START;