public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] windres: ignore trailing data at end of version block
@ 2021-02-24  1:49 Mark Harmstone
  2021-03-12 15:19 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Harmstone @ 2021-02-24  1:49 UTC (permalink / raw)
  To: binutils

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] windres: ignore trailing data at end of version block
  2021-02-24  1:49 [PATCH] windres: ignore trailing data at end of version block Mark Harmstone
@ 2021-03-12 15:19 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2021-03-12 15:19 UTC (permalink / raw)
  To: Mark Harmstone, binutils

Hi Mark,

> 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.

Please could you file a bug report for this issue:

   https://sourceware.org/bugzilla/enter_bug.cgi?product=binutils

> 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".

It looks like there is already code to handle this, but it is only
expecting 8 bytes of padding:

     else if (ch == 0)
	{
	  if (length == 8)
	    /* Padding - skip.  */
	    break;
	  fatal (_("nul bytes found in version string"));

So maybe what needs to happen is to extend this test to allow for 16
padding bytes.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-12 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24  1:49 [PATCH] windres: ignore trailing data at end of version block Mark Harmstone
2021-03-12 15:19 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).