aboutsummaryrefslogtreecommitdiff
path: root/gdb/dbxread.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-12-28 01:44:21 +0000
committerFred Fish <fnf@specifix.com>1992-12-28 01:44:21 +0000
commit51db2323667f1495d8c51b72bc32e3498418f3c4 (patch)
treebad8e0452f45fa05f83d49d3b30088c982974cb0 /gdb/dbxread.c
parent1169c958034a9cc0cd94acecd104b89243c15ba8 (diff)
downloadgdb-51db2323667f1495d8c51b72bc32e3498418f3c4.zip
gdb-51db2323667f1495d8c51b72bc32e3498418f3c4.tar.gz
gdb-51db2323667f1495d8c51b72bc32e3498418f3c4.tar.bz2
* dbxread.c (dbx_symfile_init, elfstab_build_psymtabs):
Call new bfd_get_size() and verify that string table is no larger than the file that is supposed to contain it. * symfile.c (syms_from_objfile): Only complain about configured NAMES_HAVE_UNDERSCORE differences between gdb and bfd if the current target is the default BFD target.
Diffstat (limited to 'gdb/dbxread.c')
-rw-r--r--gdb/dbxread.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 0101a3c..7b3ec79 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -595,7 +595,8 @@ dbx_symfile_init (objfile)
DBX_STRINGTAB_SIZE (objfile) = bfd_h_get_32 (sym_bfd, size_temp);
#endif
- if (DBX_STRINGTAB_SIZE (objfile) <= 0)
+ if (DBX_STRINGTAB_SIZE (objfile) <= 0
+ || DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
error ("ridiculous string table size (%d bytes).",
DBX_STRINGTAB_SIZE (objfile));
@@ -603,7 +604,8 @@ dbx_symfile_init (objfile)
(char *) obstack_alloc (&objfile -> psymbol_obstack,
DBX_STRINGTAB_SIZE (objfile));
#ifdef GDB_TARGET_IS_HPPA
- if (HP_STRINGTAB_SIZE (objfile) <= 0)
+ if (HP_STRINGTAB_SIZE (objfile) <= 0
+ || HP_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
error ("ridiculous string table size (%d bytes).",
HP_STRINGTAB_SIZE (objfile));
@@ -2095,7 +2097,8 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline,
DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
DBX_SYMTAB_OFFSET (objfile) = staboffset;
- if (stabstrsize < 0) /* FIXME: stabstrsize is unsigned; never true! */
+ if (stabstrsize < 0 /* FIXME: stabstrsize is unsigned; never true! */
+ || stabstrsize > bfd_get_size (sym_bfd))
error ("ridiculous string table size: %d bytes", stabstrsize);
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1);