Opened 13 years ago

Closed 13 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:

Description

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@… 13 years ago.
Patch

Download all attachments as: .zip

Change History (6)

by thomas.suckow@…, 13 years ago

Attachment: boost_zlib.diff added

Patch

comment:1 by thomas.suckow@…, 13 years ago

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 by thomas.suckow@…, 13 years ago

Milestone: Boost 1.40.0Boost 1.41.0

comment:3 by thomas.suckow@…, 13 years ago

Type: BugsPatches

comment:4 by Daniel James, 13 years ago

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

Thanks to Thomas Suckow.

comment:5 by Daniel James, 13 years ago

Resolution: fixed
Status: newclosed

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

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

Note: See TracTickets for help on using tickets.