Blame SOURCES/0002-CAB-block-input-buffer-is-one-byte-too-small-for-max.patch

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