1
0
mirror of https://gitlab.com/bzip2/bzip2.git synced 2025-08-09 13:22:45 +03:00
Commit Graph

18 Commits

Author SHA1 Message Date
Federico Mena Quintero
3a6f9553d2 BZ2_rand_update_mask() - Turn BZ_RAND_UPD_MASK into a function 2022-01-30 17:12:22 -08:00
Federico Mena Quintero
9fe1ae2cc9 BZ2_rand_mask() - Turn BZ_RAND_MASK into a function 2022-01-30 17:11:06 -08:00
Federico Mena Quintero
9e5d25038a BZ_rand_init() - Turn BZ_RAND_INIT_MASK into a function 2022-01-30 17:06:46 -08:00
Federico Mena Quintero
2ae5dbf531 Lowercase the names of the CRC functions 2022-01-30 17:00:31 -08:00
Federico Mena Quintero
b1c20be736 Turn the CRC32 macros into functions 2022-01-30 16:59:22 -08:00
Micah Snyder
7b44372099 Project version 1.1.0, libtool version 1:9:0
Increase the project version to 1.1.0 as this is a new feature version.

As for all new feature versions, increase the libtool .so version.
Only increase the revision, as no API's were added or removed.
It may look like I've increased it by 2, but that's because v1.0.8 used
Makefiles and was at 1:8:0.

See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
2022-01-30 11:50:37 -08:00
Mark Wielaard
812a898b76 Accept as many selectors as the file format allows.
But ignore any larger than the theoretical maximum, BZ_MAX_SELECTORS.

The theoretical maximum number of selectors depends on the maximum
blocksize (900000 bytes) and the number of symbols (50) that can be
encoded with a different Huffman tree. BZ_MAX_SELECTORS is 18002.

But the bzip2 file format allows the number of selectors to be encoded
with 15 bits (because 18002 isn't a factor of 2 and doesn't fit in
14 bits). So the file format maximum is 32767 selectors.

Some bzip2 encoders might actually have written out more selectors
than the theoretical maximum because they rounded up the number of
selectors to some convenient factor of 8.

The extra 14766 selectors can never be validly used by the decompression
algorithm. So we can read them, but then discard them.

This is effectively what was done (by accident) before we added a
check for nSelectors to be at most BZ_MAX_SELECTORS to mitigate
CVE-2019-12900.

The extra selectors were written out after the array inside the
EState struct. But the struct has extra space allocated after the
selector arrays of 18060 bytes (which is larger than 14766).
All of which will be initialized later (so the overwrite of that
space with extra selector values would have been harmless).
2019-07-10 14:39:32 -05:00
Federico Mena Quintero
39fddb72e8 Change a magic number for a constant 2019-06-05 18:55:59 -05:00
Albert Astals Cid
74de1e2e6f Make sure nSelectors is not out of range
nSelectors is used in a loop from 0 to nSelectors to access selectorMtf
which is
	UChar    selectorMtf[BZ_MAX_SELECTORS];
so if nSelectors is bigger than BZ_MAX_SELECTORS it'll do an invalid memory
access

Fixes out of bounds access discovered while fuzzying karchive
2019-06-05 18:55:59 -05:00
Mark Wielaard
5b923861db Change Julian's email address to jseward@acm.org 2019-03-30 22:56:16 +01:00
Julian Seward
962d60610c bzip2-1.0.6 2010-09-06 22:13:13 +02:00
Julian Seward
a1d78c5501 bzip2-1.0.5 2007-12-10 22:13:13 +01:00
Julian Seward
f10a33538e bzip2-1.0.4 2006-12-20 22:13:13 +01:00
Julian Seward
4d540bfc95 bzip2-1.0.3 2005-02-15 22:13:13 +01:00
Julian Seward
099d844292 bzip2-1.0.2 2001-12-30 22:13:13 +01:00
Julian Seward
795b859eee bzip2-1.0.1 2000-06-24 22:13:13 +02:00
Julian Seward
f93cd82a9a bzip2-0.9.5d 1999-09-04 22:13:13 +02:00
Julian Seward
977101ad5f bzip2-0.9.0c 1998-08-23 22:13:13 +02:00