2
1

0004-src-wav.c-Fix-heap-read-overflow.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From 42132c543358cee9f7c3e9e9b15bb6c1063a608e Mon Sep 17 00:00:00 2001
  2. From: Erik de Castro Lopo <erikd@mega-nerd.com>
  3. Date: Tue, 1 Jan 2019 20:11:46 +1100
  4. Subject: [PATCH] src/wav.c: Fix heap read overflow
  5. This is CVE-2018-19758.
  6. Closes: https://github.com/erikd/libsndfile/issues/435
  7. [Retrieved (and backported) from:
  8. https://github.com/erikd/libsndfile/commit/42132c543358cee9f7c3e9e9b15bb6c1063a608e]
  9. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  10. ---
  11. src/wav.c | 6 ++++--
  12. 1 file changed, 4 insertions(+), 2 deletions(-)
  13. diff --git a/src/wav.c b/src/wav.c
  14. index 9d71aadb..5c825f2a 100644
  15. --- a/src/wav.c
  16. +++ b/src/wav.c
  17. @@ -1,5 +1,5 @@
  18. /*
  19. -** Copyright (C) 1999-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
  20. +** Copyright (C) 1999-2019 Erik de Castro Lopo <erikd@mega-nerd.com>
  21. ** Copyright (C) 2004-2005 David Viens <davidv@plogue.com>
  22. **
  23. ** This program is free software; you can redistribute it and/or modify
  24. @@ -1146,6 +1146,8 @@ wav_write_header (SF_PRIVATE *psf, int calc_length)
  25. psf_binheader_writef (psf, "44", BHW4 (0), BHW4 (0)) ; /* SMTPE format */
  26. psf_binheader_writef (psf, "44", BHW4 (psf->instrument->loop_count), BHW4 (0)) ;
  27. + /* Loop count is signed 16 bit number so we limit it range to something sensible. */
  28. + psf->instrument->loop_count &= 0x7fff ;
  29. for (tmp = 0 ; tmp < psf->instrument->loop_count ; tmp++)
  30. { int type ;