Blob Blame History Raw
diff -Nur audiofile-0.3.6/libaudiofile/modules/BlockCodec.cpp audiofile-0.3.6-pull44/libaudiofile/modules/BlockCodec.cpp
--- audiofile-0.3.6/libaudiofile/modules/BlockCodec.cpp	2013-03-06 06:30:03.000000000 +0100
+++ audiofile-0.3.6-pull44/libaudiofile/modules/BlockCodec.cpp	2017-03-09 10:21:18.000000000 +0100
@@ -47,7 +47,7 @@
 
 	// Read the compressed data.
 	ssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount);
-	int blocksRead = bytesRead >= 0 ? bytesRead / m_bytesPerPacket : 0;
+	int blocksRead = (bytesRead >= 0 && m_bytesPerPacket > 0) ? bytesRead / m_bytesPerPacket : 0;
 
 	// Decompress into m_outChunk.
 	for (int i=0; i<blocksRead; i++)
diff -Nur audiofile-0.3.6/libaudiofile/WAVE.cpp audiofile-0.3.6-pull44/libaudiofile/WAVE.cpp
--- audiofile-0.3.6/libaudiofile/WAVE.cpp	2013-03-06 06:30:03.000000000 +0100
+++ audiofile-0.3.6-pull44/libaudiofile/WAVE.cpp	2017-03-09 10:21:18.000000000 +0100
@@ -326,6 +326,7 @@
 			{
 				_af_error(AF_BAD_NOT_IMPLEMENTED,
 					"IMA ADPCM compression supports only 4 bits per sample");
+				return AF_FAIL;
 			}
 
 			int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount;
@@ -333,6 +334,7 @@
 			{
 				_af_error(AF_BAD_CODEC_CONFIG,
 					"Invalid samples per block for IMA ADPCM compression");
+				return AF_FAIL;
 			}
 
 			track->f.sampleWidth = 16;