From 6be872a439e15d12e86e7c5889f9e0b7804e59c6 Mon Sep 17 00:00:00 2001 From: Mark Harmstone Date: Wed, 14 Apr 2021 11:53:30 +0100 Subject: [PATCH] Ignore trailing bytes at the end of a Windows Resource Version structure. PR 27686 * resbin.c (bin_to_res_version): Ignore any trailing bytes at the end of the structure. --- binutils/ChangeLog | 6 ++++++ binutils/resbin.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index daa258c4d76..8929c0700fa 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2021-04-14 Mark Harmstone + + PR 27686 + * resbin.c (bin_to_res_version): Ignore any trailing bytes at the + end of the structure. + 2021-04-14 Frederic Cambus * readelf.c (get_netbsd_elfcore_note_type): Remove unneeded #ifdef diff --git a/binutils/resbin.c b/binutils/resbin.c index b6f61f5870b..ba31077dca8 100644 --- a/binutils/resbin.c +++ b/binutils/resbin.c @@ -967,6 +967,9 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt if (type != 0) fatal (_("unexpected version type %d"), (int) type); + /* PR 27686: Ignore any padding bytes after the end of the version structure. */ + length = verlen; + data += off; length -= off; -- 2.30.2