diff --git a/binutils.git-260cd95271cdf002ed8e419898fd29c42e257841.patch b/binutils.git-260cd95271cdf002ed8e419898fd29c42e257841.patch new file mode 100644 index 0000000..de2b121 --- /dev/null +++ b/binutils.git-260cd95271cdf002ed8e419898fd29c42e257841.patch @@ -0,0 +1,69 @@ +From: Kai Tietz +Date: Wed, 28 Nov 2012 15:53:37 +0000 (+0000) +Subject: * resbin.c (bin_to_res_version): Correct offset +X-Git-Tag: binutils_latest_snapshot~48 +X-Git-Url: http://sourceware.org/git/?p=binutils.git;a=commitdiff_plain;h=260cd95271cdf002ed8e419898fd29c42e257841 + + * resbin.c (bin_to_res_version): Correct offset + and length calculation of resource. + (get_version_header): Apply alignement of 4 to len. +--- + +diff --git a/binutils/resbin.c b/binutils/resbin.c +index b5dcd9b..548ff38 100644 +--- a/binutils/resbin.c ++++ b/binutils/resbin.c +@@ -909,7 +909,7 @@ get_version_header (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt + if (length < 8) + toosmall (key); + +- *len = windres_get_16 (wrbfd, data, 2); ++ *len = (windres_get_16 (wrbfd, data, 2) + 3) & ~3; + *vallen = windres_get_16 (wrbfd, data + 2, 2); + *type = windres_get_16 (wrbfd, data + 4, 2); + +@@ -1041,10 +1041,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt + data += off; + length -= off; + +- /* It's convenient to round verlen to a 4 byte alignment, +- since we round the subvariables in the loop. */ +- +- verlen = (verlen + 3) &~ 3; ++ verlen -= off; + + vi->u.string.stringtables = NULL; + ppvst = &vi->u.string.stringtables; +@@ -1070,7 +1067,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt + length -= off; + verlen -= off; + +- stverlen = (stverlen + 3) &~ 3; ++ stverlen -= off; + + vst->strings = NULL; + ppvs = &vst->strings; +@@ -1088,14 +1085,12 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt + get_version_header (wrbfd, data, length, (const char *) NULL, + &vs->key, &sverlen, &vallen, &type, &off); + +- sverlen = (sverlen + 3) &~ 3; +- + data += off; + length -= off; + + vs->value = get_unicode (wrbfd, data, length, &vslen); + valoff = vslen * 2 + 2; +- valoff = (valoff + 3) &~ 3; ++ valoff = (valoff + 3) & ~3; + + if (off + valoff != sverlen) + fatal (_("unexpected version string length %ld != %ld + %ld"), +@@ -1108,6 +1103,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt + fatal (_("unexpected version string length %ld < %ld"), + (long) verlen, (long) sverlen); + stverlen -= sverlen; ++ verlen -= sverlen; + + vs->next = NULL; + *ppvs = vs; diff --git a/mingw-binutils.spec b/mingw-binutils.spec index 20d4a4c..2c1601c 100644 --- a/mingw-binutils.spec +++ b/mingw-binutils.spec @@ -2,7 +2,7 @@ Name: mingw-binutils Version: 2.23.51.0.5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Cross-compiled version of binutils for Win32 and Win64 environments License: GPLv2+ and LGPLv2+ and GPLv3+ and LGPLv3+ @@ -22,7 +22,11 @@ BuildRequires: mingw64-filesystem >= 95 BuildRequires: dejagnu BuildRequires: sharutils %endif -Provides: bundled(libiberty) +Provides: bundled(libiberty) + +# Resolves: *-mingw32-windres: unexpected version string length 68 != 32 + 8 +# https://bugzilla.redhat.com/show_bug.cgi?id=902960 +Patch0: binutils.git-260cd95271cdf002ed8e419898fd29c42e257841.patch %description @@ -61,6 +65,7 @@ understand Windows executables and DLLs. %prep %setup -q -n binutils-%{version} +%patch0 -p1 %build @@ -247,6 +252,9 @@ rm -rf $RPM_BUILD_ROOT/multilib %changelog +* Tue Jan 22 2013 Erik van Pienbroek - 2.23.51.0.5-3 +- Backported patch to fix 'unexpected version string length' error in windres (RHBZ #902960) + * Tue Nov 27 2012 Erik van Pienbroek - 2.23.51.0.5-2 - Added BR: zlib-devel to enable support for compressed debug sections