cherry-pick.FILE5_30-52-gd8233d09.check-one-more-read-found-by-oss-fuzz.patch 794 B

1234567891011121314151617181920212223
  1. Subject: Check one more read (found by oss-fuzz)
  2. Origin: FILE5_30-52-gd8233d09
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Fri Apr 28 15:03:47 2017 +0000
  5. --- a/src/cdf.c
  6. +++ b/src/cdf.c
  7. @@ -980,10 +980,14 @@
  8. if ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)
  9. goto out;
  10. inp[i].pi_id = CDF_GETUINT32(p, i << 1);
  11. + left = CAST(size_t, e - q);
  12. + if (left < sizeof(uint32_t)) {
  13. + DPRINTF(("short info (no type)_\n"));
  14. + goto out;
  15. + }
  16. inp[i].pi_type = CDF_GETUINT32(q, 0);
  17. DPRINTF(("%" SIZE_T_FORMAT "u) id=%x type=%x offs=0x%tx,0x%x\n",
  18. i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
  19. - left = CAST(size_t, e - q);
  20. if (inp[i].pi_type & CDF_VECTOR) {
  21. if (left < sizeof(uint32_t) * 2) {
  22. DPRINTF(("missing CDF_VECTOR length\n"));