004-CVE-2014-9636-test-compr-eb.patch 971 B

12345678910111213141516171819202122232425
  1. --- a/extract.c
  2. +++ b/extract.c
  3. @@ -2228,6 +2228,7 @@ static int test_compr_eb(__G__ eb, eb_si
  4. ulg eb_ucsize;
  5. uch *eb_ucptr;
  6. int r;
  7. + ush eb_compr_method;
  8. if (compr_offset < 4) /* field is not compressed: */
  9. return PK_OK; /* do nothing and signal OK */
  10. @@ -2244,6 +2245,14 @@ static int test_compr_eb(__G__ eb, eb_si
  11. ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN))))
  12. return IZ_EF_TRUNC; /* no/bad compressed data! */
  13. + /* 2014-11-03 Michal Zalewski, SMS.
  14. + * For STORE method, compressed and uncompressed sizes must agree.
  15. + * http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=450
  16. + */
  17. + eb_compr_method = makeword( eb + (EB_HEADSIZE + compr_offset));
  18. + if ((eb_compr_method == STORED) && (eb_size - compr_offset != eb_ucsize))
  19. + return PK_ERR;
  20. +
  21. if (
  22. #ifdef INT_16BIT
  23. (((ulg)(extent)eb_ucsize) != eb_ucsize) ||