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.

35 lines
1.2 KiB

  1. From a2e9eab8ea87c4ffc494d839ebb4ea145eb9f2e6 Mon Sep 17 00:00:00 2001
  2. From: Antonio Larrosa <larrosa@kde.org>
  3. Date: Mon, 6 Mar 2017 18:59:26 +0100
  4. Subject: [PATCH] Actually fail when error occurs in parseFormat
  5. When there's an unsupported number of bits per sample or an invalid
  6. number of samples per block, don't only print an error message using
  7. the error handler, but actually stop parsing the file.
  8. This fixes #35 (also reported at
  9. https://bugzilla.opensuse.org/show_bug.cgi?id=1026983 and
  10. https://blogs.gentoo.org/ago/2017/02/20/audiofile-heap-based-buffer-overflow-in-imadecodeblockwave-ima-cpp/
  11. )
  12. ---
  13. libaudiofile/WAVE.cpp | 2 ++
  14. 1 file changed, 2 insertions(+)
  15. --- a/libaudiofile/WAVE.cpp
  16. +++ b/libaudiofile/WAVE.cpp
  17. @@ -332,6 +332,7 @@ status WAVEFile::parseFormat(const Tag &
  18. {
  19. _af_error(AF_BAD_NOT_IMPLEMENTED,
  20. "IMA ADPCM compression supports only 4 bits per sample");
  21. + return AF_FAIL;
  22. }
  23. int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount;
  24. @@ -339,6 +340,7 @@ status WAVEFile::parseFormat(const Tag &
  25. {
  26. _af_error(AF_BAD_CODEC_CONFIG,
  27. "Invalid samples per block for IMA ADPCM compression");
  28. + return AF_FAIL;
  29. }
  30. track->f.sampleWidth = 16;