cherry-pick.FILE5_30-56-g6623a8e0.off-by-one-reading-offset-found-by-oss-fuzz.patch 561 B

12345678910111213141516
  1. Subject: Off-by-one reading offset (found by oss-fuzz)
  2. Origin: FILE5_30-56-g6623a8e0 <https://github.com/file/file/commit/FILE5_30-56-g6623a8e0>
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Sun Apr 30 17:05:02 2017 +0000
  5. --- a/src/cdf.c
  6. +++ b/src/cdf.c
  7. @@ -861,7 +861,7 @@
  8. DPRINTF(("Past end %p < %p\n", e, p));
  9. return NULL;
  10. }
  11. - if (cdf_check_stream_offset(sst, h, p, tail * sizeof(uint32_t),
  12. + if (cdf_check_stream_offset(sst, h, p, (tail + 1) * sizeof(uint32_t),
  13. __LINE__) == -1)
  14. return NULL;
  15. ofs = CDF_GETUINT32(p, tail);