[PATCH] windres: ignore trailing data at end of version block

Mark Harmstone mark@harmstone.com
Wed Feb 24 01:49:20 GMT 2021


This changes bin_to_res_version so that it only considers the number of bytes
specified in the VS_VERSION_INFO header, rather than the potentially larger
value in IMAGE_RESOURCE_DATA_ENTRY.

It seems recent versions of Microsoft's resource compiler have taken to adding
16 padding bytes in there, leading to spurious fatal errors of
"nul bytes found in version string".

---
 binutils/resbin.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/binutils/resbin.c b/binutils/resbin.c
index 79d5ffde1f..4a1f16a46e 100644
--- a/binutils/resbin.c
+++ b/binutils/resbin.c
@@ -967,6 +967,8 @@ 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);

+  length = verlen;
+
   data += off;
   length -= off;

-- 
2.26.2



More information about the Binutils mailing list