Prevent large (or negative) version values from overflowing into other fields when
authorNick Clifton <nickc@redhat.com>
Tue, 17 Jun 2014 15:50:15 +0000 (16:50 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 17 Jun 2014 15:50:15 +0000 (16:50 +0100)
parsing version strings.

PR binutils/16923
* rcparse.y (fixedverinfo): Prevent large version numbers from
corrupting other values.

binutils/ChangeLog
binutils/rcparse.y

index 50cb6cc5b333784ccd908771eb9e2df12e83fafd..71eca314fa21246c5c9a232ec7740bee030b1a8b 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-17  Anton Lavrentiwev  <lavr@ncbi.nim.nih.gov>
+
+       PR binutils/16923
+       * rcparse.y (fixedverinfo): Prevent large version numbers from
+       corrupting other values.
+
 2014-06-09  Romain Chastenet  <romain.chastenet@free.fr>
 
        PR binutils/16252
index f552ce5a65bc3855b282fe55aca6d18c0dfb981c..2d179097fc01e341c4501a31e68428f16c8da5a6 100644 (file)
@@ -1425,15 +1425,15 @@ fixedverinfo:
        | fixedverinfo FILEVERSION numexpr optcnumexpr optcnumexpr
          optcnumexpr
          {
-           $1->file_version_ms = ($3 << 16) | $4;
-           $1->file_version_ls = ($5 << 16) | $6;
+           $1->file_version_ms = ($3 << 16) | ($4 & 0xffff);
+           $1->file_version_ls = ($5 << 16) | ($6 & 0xffff);
            $$ = $1;
          }
        | fixedverinfo PRODUCTVERSION numexpr optcnumexpr optcnumexpr
          optcnumexpr
          {
-           $1->product_version_ms = ($3 << 16) | $4;
-           $1->product_version_ls = ($5 << 16) | $6;
+           $1->product_version_ms = ($3 << 16) | ($4 & 0xffff);
+           $1->product_version_ls = ($5 << 16) | ($6 & 0xffff);
            $$ = $1;
          }
        | fixedverinfo FILEFLAGSMASK numexpr