|
|
b01035 |
From fe3e1a4e9e41712b1ec115fa218af74f3286c2fe Mon Sep 17 00:00:00 2001
|
|
|
b01035 |
From: Stuart Caie <kyzer@cabextract.org.uk>
|
|
|
b01035 |
Date: Wed, 17 Oct 2018 11:33:35 +0100
|
|
|
b01035 |
Subject: [PATCH 4/5] CAB block input buffer is one byte too small for maximal
|
|
|
b01035 |
Quantum block
|
|
|
b01035 |
|
|
|
b01035 |
(cherry picked from commit 40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2)
|
|
|
b01035 |
---
|
|
|
b01035 |
libmspack/trunk/mspack/cab.h | 12 ++++++++++--
|
|
|
b01035 |
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
b01035 |
|
|
|
b01035 |
diff --git a/libmspack/trunk/mspack/cab.h b/libmspack/trunk/mspack/cab.h
|
|
|
b01035 |
index 59cf95e..25cebcb 100644
|
|
|
b01035 |
--- a/libmspack/trunk/mspack/cab.h
|
|
|
b01035 |
+++ b/libmspack/trunk/mspack/cab.h
|
|
|
b01035 |
@@ -1,5 +1,5 @@
|
|
|
b01035 |
/* This file is part of libmspack.
|
|
|
b01035 |
- * (C) 2003-2004 Stuart Caie.
|
|
|
b01035 |
+ * (C) 2003-2018 Stuart Caie.
|
|
|
b01035 |
*
|
|
|
b01035 |
* libmspack is free software; you can redistribute it and/or modify it under
|
|
|
b01035 |
* the terms of the GNU Lesser General Public License (LGPL) version 2.1
|
|
|
b01035 |
@@ -70,6 +70,14 @@
|
|
|
b01035 |
#define CAB_BLOCKMAX (32768)
|
|
|
b01035 |
#define CAB_INPUTMAX (CAB_BLOCKMAX+6144)
|
|
|
b01035 |
|
|
|
b01035 |
+/* input buffer needs to be CAB_INPUTMAX + 1 byte to allow for max-sized block
|
|
|
b01035 |
+ * plus 1 trailer byte added by cabd_sys_read_block() for Quantum alignment.
|
|
|
b01035 |
+ *
|
|
|
b01035 |
+ * When MSCABD_PARAM_SALVAGE is set, block size is not checked so can be
|
|
|
b01035 |
+ * up to 65535 bytes, so max input buffer size needed is 65535 + 1
|
|
|
b01035 |
+ */
|
|
|
b01035 |
+#define CAB_INPUTBUF (65535 + 1)
|
|
|
b01035 |
+
|
|
|
b01035 |
/* There are no more than 65535 data blocks per folder, so a folder cannot
|
|
|
b01035 |
* be more than 32768*65535 bytes in length. As files cannot span more than
|
|
|
b01035 |
* one folder, this is also their max offset, length and offset+length limit.
|
|
|
b01035 |
@@ -100,7 +108,7 @@ struct mscabd_decompress_state {
|
|
|
b01035 |
struct mspack_file *infh; /* input file handle */
|
|
|
b01035 |
struct mspack_file *outfh; /* output file handle */
|
|
|
b01035 |
unsigned char *i_ptr, *i_end; /* input data consumed, end */
|
|
|
b01035 |
- unsigned char input[CAB_INPUTMAX]; /* one input block of data */
|
|
|
b01035 |
+ unsigned char input[CAB_INPUTBUF]; /* one input block of data */
|
|
|
b01035 |
};
|
|
|
b01035 |
|
|
|
b01035 |
struct mscab_decompressor_p {
|
|
|
b01035 |
--
|
|
|
b01035 |
2.19.0.rc0
|
|
|
b01035 |
|