test_compr_eb.patch 1.1 KB

123456789101112131415161718192021222324
  1. --- extract.c 2009-03-14 02:32:52.000000000 +0100
  2. +++ extract.c 2014-12-05 22:43:13.000000000 +0100
  3. @@ -2221,10 +2234,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. + /* Return no/bad-data error status if any problem is found:
  7. + * 1. eb_size is too small to hold the uncompressed size
  8. + * (eb_ucsize). (Else extract eb_ucsize.)
  9. + * 2. eb_ucsize is zero (invalid). 2014-12-04 SMS.
  10. + * 3. eb_ucsize is positive, but eb_size is too small to hold
  11. + * the compressed data header.
  12. + */
  13. if ((eb_size < (EB_UCSIZE_P + 4)) ||
  14. - ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L &&
  15. - eb_size <= (compr_offset + EB_CMPRHEADLEN)))
  16. - return IZ_EF_TRUNC; /* no compressed data! */
  17. + ((eb_ucsize = makelong( eb+ (EB_HEADSIZE+ EB_UCSIZE_P))) == 0L) ||
  18. + ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN))))
  19. + return IZ_EF_TRUNC; /* no/bad compressed data! */
  20. if (
  21. #ifdef INT_16BIT