diff options
author | Nick Clifton <nickc@redhat.com> | 2014-06-17 16:50:15 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2014-06-17 16:50:15 +0100 |
commit | 548a23572832015e1d457188c5962e349825e86e (patch) | |
tree | 0658dba748d61b7adc30c35da12229af594c937b /binutils/rcparse.y | |
parent | 0fc059972058a4afb22882a61143c7cc48eca883 (diff) | |
download | gdb-548a23572832015e1d457188c5962e349825e86e.zip gdb-548a23572832015e1d457188c5962e349825e86e.tar.gz gdb-548a23572832015e1d457188c5962e349825e86e.tar.bz2 |
Prevent large (or negative) version values from overflowing into other fields when
parsing version strings.
PR binutils/16923
* rcparse.y (fixedverinfo): Prevent large version numbers from
corrupting other values.
Diffstat (limited to 'binutils/rcparse.y')
-rw-r--r-- | binutils/rcparse.y | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/binutils/rcparse.y b/binutils/rcparse.y index f552ce5..2d17909 100644 --- a/binutils/rcparse.y +++ b/binutils/rcparse.y @@ -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 |