X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=binutils%2Fresbin.c;h=11aa63874621acf4f6cab9e80e3abac6b3fd29c1;hb=128e85e3ab36b8e30f6612fb50de3cbb4ede6824;hp=548ff38a6c81704a4728b4c1e6e943f2203e7dcb;hpb=fb98f7b7824bd394d64f56e6aa05436f8c1a7c6c;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/resbin.c b/binutils/resbin.c index 548ff38a6c..11aa638746 100644 --- a/binutils/resbin.c +++ b/binutils/resbin.c @@ -1,6 +1,5 @@ /* resbin.c -- manipulate the Windows binary resource format. - Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011 - Free Software Foundation, Inc. + Copyright (C) 1997-2016 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Rewritten by Kai Tietz, Onevision. @@ -962,9 +961,10 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt get_version_header (wrbfd, data, length, "VS_VERSION_INFO", (unichar **) NULL, &verlen, &vallen, &type, &off); - if ((unsigned int) verlen != length) - fatal (_("version length %d does not match resource length %lu"), - (int) verlen, (unsigned long) length); + /* PR 17512: The verlen field does not include padding length. */ + if (verlen > length) + fatal (_("version length %lu greater than resource length %lu"), + (unsigned long) verlen, (unsigned long) length); if (type != 0) fatal (_("unexpected version type %d"), (int) type); @@ -1068,7 +1068,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt verlen -= off; stverlen -= off; - + vst->strings = NULL; ppvs = &vst->strings; @@ -1165,8 +1165,15 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type lengt vallen -= 4; } } + else if (ch == 0) + { + if (length == 8) + /* Padding - skip. */ + break; + fatal (_("nul bytes found in version string")); + } else - fatal (_("unexpected version string")); + fatal (_("unexpected version string character: %x"), ch); vi->next = NULL; *pp = vi; @@ -1319,7 +1326,7 @@ resid_to_bin (windres_bfd *wrbfd, rc_uint_type off, rc_res_id id) if (wrbfd) { struct bin_res_id bri; - + windres_put_16 (wrbfd, bri.sig, 0xffff); windres_put_16 (wrbfd, bri.id, id.u.id); set_windres_bfd_content (wrbfd, &bri, off, BIN_RES_ID); @@ -1557,7 +1564,7 @@ res_to_bin_dialog (windres_bfd *wrbfd, rc_uint_type off, const rc_dialog *dialog windres_put_32 (wrbfd, bdc.id, dc->id); set_windres_bfd_content (wrbfd, &bdc, off, BIN_DIALOGEX_CONTROL_SIZE); } - } + } off += (dialogex != 0 ? BIN_DIALOGEX_CONTROL_SIZE : BIN_DIALOG_CONTROL_SIZE); off = resid_to_bin (wrbfd, off, dc->class);