patch-libaudiofile_WAVE_cpp 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. --- audiofile-0.3.6.orig/libaudiofile/WAVE.cpp 2013-03-06 06:30:03.000000000 +0100
  2. +++ audiofile-0.3.6/libaudiofile/WAVE.cpp 2017-04-26 02:15:19.828763007 +0200
  3. @@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &
  4. /* numCoefficients should be at least 7. */
  5. assert(numCoefficients >= 7 && numCoefficients <= 255);
  6. + if (numCoefficients < 7 || numCoefficients > 255)
  7. + {
  8. + _af_error(AF_BAD_HEADER,
  9. + "Bad number of coefficients");
  10. + return AF_FAIL;
  11. + }
  12. m_msadpcmNumCoefficients = numCoefficients;
  13. @@ -326,6 +332,7 @@ status WAVEFile::parseFormat(const Tag &
  14. {
  15. _af_error(AF_BAD_NOT_IMPLEMENTED,
  16. "IMA ADPCM compression supports only 4 bits per sample");
  17. + return AF_FAIL;
  18. }
  19. int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount;
  20. @@ -333,6 +340,7 @@ status WAVEFile::parseFormat(const Tag &
  21. {
  22. _af_error(AF_BAD_CODEC_CONFIG,
  23. "Invalid samples per block for IMA ADPCM compression");
  24. + return AF_FAIL;
  25. }
  26. track->f.sampleWidth = 16;