Magellan Linux

Annotation of /trunk/audiofile/patches/audiofile-0.3.6-Check-for-division-by-zero-in-BlockCodec-runPull.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3077 - (hide annotations) (download)
Mon Jan 22 12:38:50 2018 UTC (6 years, 3 months ago) by niro
File size: 826 byte(s)
-added several security and build fixes
1 niro 3077 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
4    
5     ---
6     libaudiofile/modules/BlockCodec.cpp | 2 +-
7     1 file changed, 1 insertion(+), 1 deletion(-)
8    
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()
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++)