You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
826 B

  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
  4. ---
  5. libaudiofile/modules/BlockCodec.cpp | 2 +-
  6. 1 file changed, 1 insertion(+), 1 deletion(-)
  7. diff --git a/libaudiofile/modules/BlockCodec.cpp b/libaudiofile/modules/BlockCodec.cpp
  8. index 4731be1..eb2fb4d 100644
  9. --- a/libaudiofile/modules/BlockCodec.cpp
  10. +++ b/libaudiofile/modules/BlockCodec.cpp
  11. @@ -47,7 +47,7 @@ void BlockCodec::runPull()
  12. // Read the compressed data.
  13. ssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount);
  14. - int blocksRead = bytesRead >= 0 ? bytesRead / m_bytesPerPacket : 0;
  15. + int blocksRead = (bytesRead >= 0 && m_bytesPerPacket > 0) ? bytesRead / m_bytesPerPacket : 0;
  16. // Decompress into m_outChunk.
  17. for (int i=0; i<blocksRead; i++)