Ticket #3352 (closed Patches: fixed)

Opened 8 years ago

Last modified 7 years ago

CRC not correctly computed on x64 during decompression of gzip archive

Reported by: thomas.suckow@… Owned by: 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


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

Change History

Changed 8 years ago by thomas.suckow@…


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 changed from Boost 1.40.0 to Boost 1.41.0

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

  • Type changed from Bugs to Patches

comment:4 Changed 7 years ago by danieljames

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

Thanks to Thomas Suckow.

comment:5 Changed 7 years ago by danieljames

  • Status changed from new to closed
  • Resolution set to fixed

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

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


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

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

Note: See TracTickets for help on using tickets.