Opened 8 years ago

Closed 8 years ago

#3352 closed Patches (fixed)

CRC not correctly computed on x64 during decompression of gzip archive

Reported by: thomas.suckow@… Owned by: Jonathan Turkanis
Milestone: Boost 1.41.0 Component: iostreams
Version: Boost Development Trunk Severity: Problem
Keywords: x64 64bit gzip iostreams Cc:


A difference in datatypes causes an overflow error (or lack thereof).

Steps to reproduce:

  1. Generate a gzip archive of sufficient size (140K?)
  2. Decompress with iostreams filter.

Attached: Proposed change to zlib typedefs
Tested on Kubuntu x86 & Debian x64

Attachments (1)

boost_zlib.diff (961 bytes) - added by thomas.suckow@… 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by thomas.suckow@…

Attachment: boost_zlib.diff added


comment:1 Changed 8 years ago by thomas.suckow@…

Line of fault is:

crc_ += value << (offset_ * 8);

in gzip.cpp

When the shift results in a large negative value, the 32bit crc should roll over. But long on x64 is 64bit and the result is incorrect.

comment:2 Changed 8 years ago by thomas.suckow@…

Milestone: Boost 1.40.0Boost 1.41.0

comment:3 Changed 8 years ago by thomas.suckow@…

Type: BugsPatches

comment:4 Changed 8 years ago by Daniel James

(In [57610]) Fix CRC on x64 during gzip decompression. Refs #3352.

Thanks to Thomas Suckow.

comment:5 Changed 8 years ago by Daniel James

Resolution: fixed
Status: newclosed

(In [58633]) Merge iostream fixes, mostly by Richard Smith.

Fixes #3612, #3311, #2094, #3010, #2894, #3011, #3352, #3505.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jonathan Turkanis.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.