002-CVE-2014-8140-test-compr-eb.patch 1.1 KB

1234567891011121314151617181920212223
  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. + /* 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