cherry-pick.FILE5_30-14-ga0b25417.use-the-correct-buffer-size-found-by-oss-fuzz.patch 615 B

12345678910111213141516
  1. Subject: Use the correct buffer size; found by oss-fuzz
  2. Origin: FILE5_30-14-ga0b25417
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Thu Mar 9 16:57:53 2017 +0000
  5. --- a/src/readcdf.c
  6. +++ b/src/readcdf.c
  7. @@ -603,7 +603,7 @@
  8. if ((i = cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  9. "FileHeader", &scn)) != -1) {
  10. #define HWP5_SIGNATURE "HWP Document File"
  11. - if (scn.sst_dirlen >= sizeof(HWP5_SIGNATURE) - 1
  12. + if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  13. && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  14. sizeof(HWP5_SIGNATURE) - 1) == 0) {
  15. if (NOTMIME(ms)) {