* dbxread.c (set_namestring): Remove cast to unsigned. Check N_STRX
authorJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 17 Nov 2009 20:48:31 +0000 (20:48 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 17 Nov 2009 20:48:31 +0000 (20:48 +0000)
overflow.

gdb/ChangeLog
gdb/dbxread.c

index abfe2dd431e9eae05889e87eee710043b761422d..f966e9d355e1f92b2229f8033a3fd24ddd29d46b 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * dbxread.c (set_namestring): Remove cast to unsigned.  Check N_STRX
+       overflow.
+
 2009-11-17  Nathan Sidwell  <nathan@codesourcery.com>
 
        * features/m68k-core.xml: New file.
index 54d8b51fdc707fc0c69ef790ac8b74ded9823761..6d4c893f167d3374d90334538c116f62a14b9b86 100644 (file)
@@ -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);