|
1 | 1 | /* This file is part of libmspack. |
2 | | - * (C) 2003-2004 Stuart Caie. |
| 2 | + * (C) 2003-2018 Stuart Caie. |
3 | 3 | * |
4 | 4 | * libmspack is free software; you can redistribute it and/or modify it under |
5 | 5 | * the terms of the GNU Lesser General Public License (LGPL) version 2.1 |
|
70 | 70 | #define CAB_BLOCKMAX (32768) |
71 | 71 | #define CAB_INPUTMAX (CAB_BLOCKMAX+6144) |
72 | 72 |
|
| 73 | +/* input buffer needs to be CAB_INPUTMAX + 1 byte to allow for max-sized block |
| 74 | + * plus 1 trailer byte added by cabd_sys_read_block() for Quantum alignment. |
| 75 | + * |
| 76 | + * When MSCABD_PARAM_SALVAGE is set, block size is not checked so can be |
| 77 | + * up to 65535 bytes, so max input buffer size needed is 65535 + 1 |
| 78 | + */ |
| 79 | +#define CAB_INPUTBUF (65535 + 1) |
| 80 | + |
73 | 81 | /* There are no more than 65535 data blocks per folder, so a folder cannot |
74 | 82 | * be more than 32768*65535 bytes in length. As files cannot span more than |
75 | 83 | * one folder, this is also their max offset, length and offset+length limit. |
@@ -101,7 +109,7 @@ struct mscabd_decompress_state { |
101 | 109 | struct mspack_file *infh; /* input file handle */ |
102 | 110 | struct mspack_file *outfh; /* output file handle */ |
103 | 111 | unsigned char *i_ptr, *i_end; /* input data consumed, end */ |
104 | | - unsigned char input[CAB_INPUTMAX]; /* one input block of data */ |
| 112 | + unsigned char input[CAB_INPUTBUF]; /* one input block of data */ |
105 | 113 | }; |
106 | 114 |
|
107 | 115 | struct mscab_decompressor_p { |
|
0 commit comments