projects/guix·blob python-team · refs

21 lines · 826 B

1From: Antonio Larrosa <[email protected]>
2Date: Thu, 9 Mar 2017 10:21:18 +0100
3Subject: Check for division by zero in BlockCodec::runPull
4
5---
6 libaudiofile/modules/BlockCodec.cpp | 2 +-
7 1 file changed, 1 insertion(+), 1 deletion(-)
8
9diff --git a/libaudiofile/modules/BlockCodec.cpp b/libaudiofile/modules/BlockCodec.cpp
10index 4731be1..eb2fb4d 100644
11--- a/libaudiofile/modules/BlockCodec.cpp
12+++ b/libaudiofile/modules/BlockCodec.cpp
13@@ -47,7 +47,7 @@ void BlockCodec::runPull()
14
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;
19
20 // Decompress into m_outChunk.
21 for (int i=0; i<blocksRead; i++)