This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix crash in charset code
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 20 Mar 2009 18:26:22 -0600
- Subject: FYI: fix crash in charset code
- Reply-to: Tom Tromey <tromey at redhat dot com>
I'm checking this in.
Within minutes, Pedro found a bug in the charset code.
We could call TYPE_LENGTH on a type without previously calling
check_typedef. This yielded 0, causing a crash when we attempted to
divide later on.
The fix is to call check_typedef before using TYPE_LENGTH.
Tom
2009-03-20 Tom Tromey <tromey@redhat.com>
* c-lang.c (evaluate_subexp_c): Call check_typedef.
Index: c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.62
diff -u -r1.62 c-lang.c
--- c-lang.c 20 Mar 2009 23:04:30 -0000 1.62
+++ c-lang.c 21 Mar 2009 00:21:43 -0000
@@ -917,6 +917,10 @@
default:
internal_error (__FILE__, __LINE__, "unhandled c_string_type");
}
+
+ /* Ensure TYPE_LENGTH is valid for TYPE. */
+ check_typedef (type);
+
dest_charset = charset_for_string_type (dest_type);
++*pos;