You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB

  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. ---
  10. libaudiofile/WAVE.cpp | 6 ++++++
  11. 1 file changed, 6 insertions(+)
  12. diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
  13. index 0e81cf7..61f9541 100644
  14. --- a/libaudiofile/WAVE.cpp
  15. +++ b/libaudiofile/WAVE.cpp
  16. @@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
  17. /* numCoefficients should be at least 7. */
  18. assert(numCoefficients >= 7 && numCoefficients <= 255);
  19. + if (numCoefficients < 7 || numCoefficients > 255)
  20. + {
  21. + _af_error(AF_BAD_HEADER,
  22. + "Bad number of coefficients");
  23. + return AF_FAIL;
  24. + }
  25. m_msadpcmNumCoefficients = numCoefficients;
  26. --
  27. 2.11.0