Package: zlib1g-dev:amd64
Version: 1:1.2.6.dfsg-2
The declaration of get_crc_table() in zlib.h has wrong return type for LP64
platforms.
Please update zlib package to zlib-1.2.7 which fixes the problem.
get_crc_table() returns a table for calculating CRC.
zlib-1.2.3 uses unsigned long for the table entries.
zlib-1.2.6 uses unsigned 32 bit integer for the table entries.
However the return type of get_crc_table() is not changed at zlib-1.2.6.
So zlib-1.2.6 has type mismatch between actual table entries and return
type of get_crc_table.
The problem can be reproduced as follows.
% dpkg -l|grep zlib
ii zlib1g:amd64 1:1.2.6.dfsg-2
compression library - runtime
ii zlib1g-dev:amd64 1:1.2.6.dfsg-2
compression library - development
% lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux testing (wheezy)
Release: testing
Codename: wheezy
% cat tst.c
#include <stdio.h>
#include <zlib.h>
int main(int argc, char *argv[])
{
printf("zlib header version: %s\n", ZLIB_VERSION);
printf("zlib library version: %s\n", zlibVersion());
printf("sizeof(long) = %d\n", (int)sizeof(long));
printf("sizeof(get_crc_table()[0]) = %d\n",
(int)sizeof(get_crc_table()[0]));
printf("get_crc_table()[0] = %#016lx\n", (unsigned long)get_crc_table()[0]);
printf("get_crc_table()[1] = %#016lx\n", (unsigned long)get_crc_table()[1]);
printf("get_crc_table()[2] = %#016lx\n", (unsigned long)get_crc_table()[2]);
printf("get_crc_table()[3] = %#016lx\n", (unsigned long)get_crc_table()[3]);
return 0;
}
% gcc -Wall tst.c -lz
% ./a.out
zlib header version: 1.2.6
zlib library version: 1.2.6
sizeof(long) = 8
sizeof(get_crc_table()[0]) = 8
get_crc_table()[0] = 0x7707309600000000
get_crc_table()[1] = 0x990951baee0e612c
get_crc_table()[2] = 0x706af48f076dc419
get_crc_table()[3] = 0x9e6495a3e963a535
get_crc_table()[0] returns 0x7707309600000000.
But it should return 0, according to zlib-1.2.6.dfsg/crc32.h.
% head zlib-1.2.6.dfsg/crc32.h
/* crc32.h -- tables for rapid CRC calculation
* Generated automatically by crc32.c
*/
local const crc_table_t FAR crc_table[TBLS][256] =
{
{
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
zlib-1.2.3 returns 0 correctly as follows.
% dpkg -l|grep zlib
ii zlib1g 1:1.2.3.4.dfsg-3
compression library - runtime
ii zlib1g-dev 1:1.2.3.4.dfsg-3
compression library - development
% lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.4 (squeeze)
Release: 6.0.4
Codename: squeeze
% gcc -Wall tst.c -lz
% ./a.out
zlib header version: 1.2.3.4
zlib library version: 1.2.3.4
sizeof(long) = 8
sizeof(get_crc_table()[0]) = 8
get_crc_table()[0] = 0000000000000000
get_crc_table()[1] = 0x00000077073096
get_crc_table()[2] = 0x000000ee0e612c
get_crc_table()[3] = 0x000000990951ba
--
Tanaka Akira
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]