CVE-2014-0207.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. made apply cleanly based on, removed all modifications to src/readcdf.c (for CVE-2012-1571) as the problematic code was introduced later.
  2. commit 6d209c1c489457397a5763bca4b28e43aac90391
  3. Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Mon May 5 16:11:21 2014 +0000
  5. Apply patches from file-CVE-2012-1571.patch
  6. From Francisco Alonso Espejo:
  7. file < 5.18/git version can be made to crash when checking some
  8. corrupt CDF files (Using an invalid cdf_read_short_sector size)
  9. The problem I found here, is that in most situations (if
  10. h_short_sec_size_p2 > 8) because the blocksize is 512 and normal
  11. values are 06 which means reading 64 bytes.As long as the check
  12. for the block size copy is not checked properly (there's an assert
  13. that makes wrong/invalid assumptions)
  14. diff --git a/src/cdf.c b/src/cdf.c
  15. index 2573a5f..f7c46ae 100644
  16. --- a/src/cdf.c
  17. +++ b/src/cdf.c
  18. @@ -355,10 +355,10 @@ cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs,
  19. size_t ss = CDF_SHORT_SEC_SIZE(h);
  20. size_t pos = CDF_SHORT_SEC_POS(h, id);
  21. assert(ss == len);
  22. - if (pos > CDF_SEC_SIZE(h) * sst->sst_len) {
  23. + if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
  24. DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
  25. SIZE_T_FORMAT "u\n",
  26. - pos, CDF_SEC_SIZE(h) * sst->sst_len));
  27. + pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
  28. return -1;
  29. }
  30. (void)memcpy(((char *)buf) + offs,