CVE-2014-0238.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. made apply cleanly based on
  2. commit f97486ef5dc3e8735440edc4fc8808c63e1a3ef0
  3. Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Wed May 21 13:04:38 2014 +0000
  5. CVE-2014-0207: Prevent 0 element vectors and vectors longer than the number
  6. of properties from accessing random memory.
  7. diff --git a/src/cdf.c b/src/cdf.c
  8. index 48a00ec..375406c 100644
  9. --- a/src/cdf.c
  10. +++ b/src/cdf.c
  11. @@ -813,6 +813,10 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
  12. i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
  13. if (inp[i].pi_type & CDF_VECTOR) {
  14. nelements = CDF_GETUINT32(q, 1);
  15. + if (nelements == 0) {
  16. + DPRINTF(("CDF_VECTOR with nelements == 0\n"));
  17. + goto out;
  18. + }
  19. o = 2;
  20. } else {
  21. nelements = 1;
  22. @@ -887,7 +887,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
  23. }
  24. DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
  25. nelements));
  26. - for (j = 0; j < nelements; j++, i++) {
  27. + for (j = 0; j < nelements && i < sh.sh_properties;
  28. + j++, i++)
  29. + {
  30. uint32_t l = CDF_GETUINT32(q, o);
  31. inp[i].pi_str.s_len = l;
  32. inp[i].pi_str.s_buf = (const char *)