db-move: moved webkit2gtk from [testing] to [extra] (x86_64)
[arch-packages.git] / audiofile / trunk / 10_Check-for-division-by-zero-in-BlockCodec-runPull.patch
blobe001133916e2727b190ab442ab1ad8e2f2cbaa72
1 From: Antonio Larrosa <larrosa@kde.org>
2 Date: Thu, 9 Mar 2017 10:21:18 +0100
3 Subject: Check for division by zero in BlockCodec::runPull
5 ---
6 libaudiofile/modules/BlockCodec.cpp | 2 +-
7 1 file changed, 1 insertion(+), 1 deletion(-)
9 diff --git a/libaudiofile/modules/BlockCodec.cpp b/libaudiofile/modules/BlockCodec.cpp
10 index 4731be1..eb2fb4d 100644
11 --- a/libaudiofile/modules/BlockCodec.cpp
12 +++ b/libaudiofile/modules/BlockCodec.cpp
13 @@ -47,7 +47,7 @@ void BlockCodec::runPull()
15 // Read the compressed data.
16 ssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount);
17 - int blocksRead = bytesRead >= 0 ? bytesRead / m_bytesPerPacket : 0;
18 + int blocksRead = (bytesRead >= 0 && m_bytesPerPacket > 0) ? bytesRead / m_bytesPerPacket : 0;
20 // Decompress into m_outChunk.
21 for (int i=0; i<blocksRead; i++)