0003-Always-check-the-number-of-coefficients.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From c48e4c6503f7dabd41f11d4c9c7b7f8960e7f2c0 Mon Sep 17 00:00:00 2001
  2. From: Antonio Larrosa <larrosa@kde.org>
  3. Date: Mon, 6 Mar 2017 12:51:22 +0100
  4. Subject: [PATCH] Always check the number of coefficients
  5. When building the library with NDEBUG, asserts are eliminated
  6. so it's better to always check that the number of coefficients
  7. is inside the array range.
  8. This fixes the 00191-audiofile-indexoob issue in #41
  9. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  10. ---
  11. libaudiofile/WAVE.cpp | 6 ++++++
  12. 1 file changed, 6 insertions(+)
  13. diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
  14. index 0e81cf7..61f9541 100644
  15. --- a/libaudiofile/WAVE.cpp
  16. +++ b/libaudiofile/WAVE.cpp
  17. @@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
  18. /* numCoefficients should be at least 7. */
  19. assert(numCoefficients >= 7 && numCoefficients <= 255);
  20. + if (numCoefficients < 7 || numCoefficients > 255)
  21. + {
  22. + _af_error(AF_BAD_HEADER,
  23. + "Bad number of coefficients");
  24. + return AF_FAIL;
  25. + }
  26. m_msadpcmNumCoefficients = numCoefficients;
  27. --
  28. 2.11.0