aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-01-14 09:15:13 +0000
committerNick Clifton <nickc@redhat.com>2021-01-14 09:15:13 +0000
commit7e0d77ef5ffa7e47655db2a5df5082004f7c104e (patch)
tree470243151515f6297d8b51b59b8ca28cecf0a2a5 /bfd/elf.c
parent271bea6acd3759db96b33a30f110ee5e1f8146fc (diff)
downloadgdb-7e0d77ef5ffa7e47655db2a5df5082004f7c104e.zip
gdb-7e0d77ef5ffa7e47655db2a5df5082004f7c104e.tar.gz
gdb-7e0d77ef5ffa7e47655db2a5df5082004f7c104e.tar.bz2
Fix an illegal memory access parsing a win32pstatus note with a type of 0.
* elf.c (elfcore_grok_win32pstatus): Check for a note type of 0.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index ab19bdb..84a5d94 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10163,7 +10163,8 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
type = bfd_get_32 (abfd, note->descdata);
- struct {
+ struct
+ {
const char *type_name;
unsigned long min_size;
} size_check[] =
@@ -10174,7 +10175,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
{ "NOTE_INFO_MODULE64", 16 },
};
- if (type > (sizeof(size_check)/sizeof(size_check[0])))
+ if (type == 0 || type > (sizeof(size_check)/sizeof(size_check[0])))
return TRUE;
if (note->descsz < size_check[type - 1].min_size)