cab: Translate E8 calls only in first 1 GB of data
The cab specification states that E8 translation shall be performed only within the first 1 GB range of an uncompressed file, i.e. for the first 0x8000 CFDATA entries in a folder. Take this limit properly into account. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
This commit is contained in:
1 parent
42b2444920
commit
220eefe346
1 file changed
+2
-1
@@ -204,6 +204,7 @@ struct lzx_stream {
|
||||
/* Limits */
|
||||
#define MAX_UNCOMPRESS_SIZE 0x8000
|
||||
#define MAX_FILE_SIZE (UINT16_MAX * MAX_UNCOMPRESS_SIZE)
|
||||
#define MAX_E8_TRANSLATION (0x8000 * MAX_UNCOMPRESS_SIZE)
|
||||
|
||||
static const char * const compression_name[] = {
|
||||
"NONE",
|
||||
@@ -2217,7 +2218,7 @@ lzx_translation(struct lzx_stream *strm, unsigned char *buffer, size_t size,
|
||||
struct lzx_dec *ds = strm->ds;
|
||||
unsigned char *p, *end;
|
||||
|
||||
if (!ds->translation || size <= 10)
|
||||
if (!ds->translation || offset >= MAX_E8_TRANSLATION || size <= 10)
|
||||
return;
|
||||
|
||||
p = buffer;
|
||||
|
||||
Reference in new issue
Block a user