b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | --- a/extract.c |
| 2 | +++ b/extract.c |
| 3 | @@ -2232,10 +2232,17 @@ static int test_compr_eb(__G__ eb, eb_si |
| 4 | if (compr_offset < 4) /* field is not compressed: */ |
| 5 | return PK_OK; /* do nothing and signal OK */ |
| 6 | |
| 7 | + /* Return no/bad-data error status if any problem is found: |
| 8 | + * 1. eb_size is too small to hold the uncompressed size |
| 9 | + * (eb_ucsize). (Else extract eb_ucsize.) |
| 10 | + * 2. eb_ucsize is zero (invalid). 2014-12-04 SMS. |
| 11 | + * 3. eb_ucsize is positive, but eb_size is too small to hold |
| 12 | + * the compressed data header. |
| 13 | + */ |
| 14 | if ((eb_size < (EB_UCSIZE_P + 4)) || |
| 15 | - ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L && |
| 16 | - eb_size <= (compr_offset + EB_CMPRHEADLEN))) |
| 17 | - return IZ_EF_TRUNC; /* no compressed data! */ |
| 18 | + ((eb_ucsize = makelong( eb+ (EB_HEADSIZE+ EB_UCSIZE_P))) == 0L) || |
| 19 | + ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN)))) |
| 20 | + return IZ_EF_TRUNC; /* no/bad compressed data! */ |
| 21 | |
| 22 | if ( |
| 23 | #ifdef INT_16BIT |