From 5409dacfb9b62964f95af8c693fa708baf60ecdd Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 17 Nov 2009 20:48:31 +0000 Subject: [PATCH] * dbxread.c (set_namestring): Remove cast to unsigned. Check N_STRX overflow. --- gdb/ChangeLog | 5 +++++ gdb/dbxread.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index abfe2dd431e..f966e9d355e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-11-17 Jan Kratochvil + + * dbxread.c (set_namestring): Remove cast to unsigned. Check N_STRX + overflow. + 2009-11-17 Nathan Sidwell * features/m68k-core.xml: New file. diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 54d8b51fdc7..6d4c893f167 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -965,8 +965,9 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist) { char *namestring; - if (((unsigned) nlist->n_strx + file_string_table_offset) - >= DBX_STRINGTAB_SIZE (objfile)) + if (nlist->n_strx + file_string_table_offset + >= DBX_STRINGTAB_SIZE (objfile) + || nlist->n_strx + file_string_table_offset < nlist->n_strx) { complaint (&symfile_complaints, _("bad string table offset in symbol %d"), symnum); -- 2.30.2