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

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