X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=binutils%2Fresbin.c;h=ba31077dca8e700c17bf429b2808ce973ff450fb;hb=67609c9c701ea8a679d80e3352266b058b184f4b;hp=11aa63874621acf4f6cab9e80e3abac6b3fd29c1;hpb=2d5bddc1eb5d2c04ed142c7ba6fc13e2e3a28079;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/resbin.c b/binutils/resbin.c index 11aa638746..ba31077dca 100644 --- a/binutils/resbin.c +++ b/binutils/resbin.c @@ -1,5 +1,5 @@ /* resbin.c -- manipulate the Windows binary resource format. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Rewritten by Kai Tietz, Onevision. @@ -574,8 +574,6 @@ bin_to_res_dialog (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length dc->data = NULL; else { - off = (off + 3) &~ 3; - if (length < off + datalen) toosmall (_("dialog control data")); @@ -969,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; @@ -1582,7 +1583,6 @@ res_to_bin_dialog (windres_bfd *wrbfd, rc_uint_type off, const rc_dialog *dialog { rc_uint_type saved_off = off; rc_uint_type old_off; - off += (4 - ((off - off_delta) & 3)) & 3; old_off = off; off = res_to_bin_rcdata (wrbfd, off, dc->data); @@ -1590,10 +1590,10 @@ res_to_bin_dialog (windres_bfd *wrbfd, rc_uint_type off, const rc_dialog *dialog old_off = off = saved_off; if (wrbfd) windres_put_16 (wrbfd, dc_rclen, off - old_off); - } + } if (wrbfd) set_windres_bfd_content (wrbfd, dc_rclen, marker, 2); - } + } if (wrbfd) {