aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-02-27 15:38:32 +0000
committerNick Clifton <nickc@redhat.com>2015-02-27 15:40:49 +0000
commitcdb602b17548eeebb5e700c507d734ea5f887a49 (patch)
tree5544597374d050c85e22c8a1f9ebc728768d9a41 /bfd/coffgen.c
parent6f98576f29a70ed947f102015df0388bccc6aa1a (diff)
downloadgdb-cdb602b17548eeebb5e700c507d734ea5f887a49.zip
gdb-cdb602b17548eeebb5e700c507d734ea5f887a49.tar.gz
gdb-cdb602b17548eeebb5e700c507d734ea5f887a49.tar.bz2
Fixes a problem recognizing libraries created by Visual Studio.
PR binutils/17910 * coffgen.c (_bfd_coff_internal_syment_name): Only check for string length overflow when the string table length is actually set.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index aa01559..83673d4 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -468,7 +468,10 @@ _bfd_coff_internal_syment_name (bfd *abfd,
if (strings == NULL)
return NULL;
}
- if (sym->_n._n_n._n_offset >= obj_coff_strings_len (abfd))
+ /* PR 17910: Only check for string overflow if the length has been set.
+ Some DLLs, eg those produced by Visual Studio, may not set the length field. */
+ if (obj_coff_strings_len (abfd) > 0
+ && sym->_n._n_n._n_offset >= obj_coff_strings_len (abfd))
return NULL;
return strings + sym->_n._n_n._n_offset;
}