Skip to content

Commit

Permalink
Bugfix: use 32 bit array for crc_table in zlib
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Jul 4, 2024
1 parent 9c01a54 commit e489f89
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions deps/abc/src/misc/zlib/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,13 @@ ABC_NAMESPACE_IMPL_START
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
const unsigned long FAR * ZEXPORT get_crc_table()
const unsigned FAR * ZEXPORT get_crc_table() /* changed long -> unsigned (see crc32.h) */
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
make_crc_table();
#endif /* DYNAMIC_CRC_TABLE */
return (const unsigned long FAR *)crc_table;
return (const unsigned FAR *)crc_table;
}

/* ========================================================================= */
Expand Down
10 changes: 9 additions & 1 deletion deps/abc/src/misc/zlib/crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@

ABC_NAMESPACE_HEADER_START

local const unsigned long FAR crc_table[TBLS][256] =
/* changed long -> unsigned
The curse of having a library frozen at an rather old version. In recent
versions the variable bit size gets adjusted according to system and
compile flags. By now we need unsigned (32 bit) since that is what
QuaZip expects.
*/

local const unsigned FAR crc_table[TBLS][256] =
{
{
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/misc/zlib/zlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
ZEXTERN const unsigned * ZEXPORT get_crc_table OF((void)); /* changed long -> unsigned (see crc32.h) */
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));

ABC_NAMESPACE_HEADER_END
Expand Down

0 comments on commit e489f89

Please sign in to comment.