From: Nick Clifton Date: Fri, 3 Jan 2020 16:17:53 +0000 (+0000) Subject: Fix potential illegal memory access when parsing a corrupt PEF format file. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2a3559d54602cecfec6d90f792be4a70ad918ab;p=binutils-gdb.git Fix potential illegal memory access when parsing a corrupt PEF format file. PR 25307 (bfd_pef_parse_function_stubs): Correct the test that ensures that there is enough data remaining in the code buffer before attempting to read a function stub. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7fb5bcad595..0ad28a798d0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2020-01-03 Nick Clifton + + PR 25307 + (bfd_pef_parse_function_stubs): Correct the test that ensures that + there is enough data remaining in the code buffer before + attempting to read a function stub. + 2020-01-03 Nick Clifton PR 25308 diff --git a/bfd/pef.c b/bfd/pef.c index 726b8d7493d..574d9bcb5d6 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -806,7 +806,7 @@ bfd_pef_parse_function_stubs (bfd *abfd, codepos += 4; } - if ((codepos + 4) > codelen) + if ((codepos + 24) > codelen) break; ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &sym_index);