[PATCH] ada-lang.c, null pointer
Joel Brobecker
brobecker@adacore.com
Tue Aug 14 20:21:00 GMT 2007
> Yeah, Joel, that looks fine to me. You want to check it in?
Cool!
2007-08-14 Joel Brobecker <brobecker@adacore.com>
Michael Snyder <msnyder@access-company.com>
* ada-lang.c (field_alignment): Guard against NULL.
I have checked this in.
Thanks again, Michael.
--
Joel
-------------- next part --------------
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.100
diff -u -p -r1.100 ada-lang.c
--- ada-lang.c 6 Aug 2007 20:07:44 -0000 1.100
+++ ada-lang.c 14 Aug 2007 03:45:04 -0000
@@ -6116,9 +6116,17 @@ static unsigned int
field_alignment (struct type *type, int f)
{
const char *name = TYPE_FIELD_NAME (type, f);
- int len = (name == NULL) ? 0 : strlen (name);
+ int len;
int align_offset;
+ /* The field name should never be null, unless the debugging information
+ is somehow malformed. In this case, we assume the field does not
+ require any alignment. */
+ if (name == NULL)
+ return 1;
+
+ len = strlen (name);
+
if (!isdigit (name[len - 1]))
return 1;
More information about the Gdb-patches
mailing list