From 64a1bf195752a461f0e44b853a1e2769d182de3b Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Tue, 14 Aug 2007 20:16:18 +0000 Subject: * ada-lang.c (field_alignment): Guard against NULL. --- gdb/ada-lang.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 0a27ba0..4b1e292 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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; -- cgit v1.1