File soundtouch-throw-exception.patch of Package soundtouch.9260

From a1c400eb2cff849c0e5f9d6916d69ffea3ad2c85 Mon Sep 17 00:00:00 2001
From: Olli <oparviai@iki.fi>
Date: Sun, 28 Oct 2018 15:32:58 +0200
Subject: [PATCH] Fix issue CVE-2018-17096: Replace assert with runtime
 exception

---
 source/SoundTouch/BPMDetect.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: soundtouch/source/SoundTouch/BPMDetect.cpp
===================================================================
--- soundtouch.orig/source/SoundTouch/BPMDetect.cpp
+++ soundtouch/source/SoundTouch/BPMDetect.cpp
@@ -130,8 +130,10 @@ BPMDetect::BPMDetect(int numChannels, in
 
     // choose decimation factor so that result is approx. 1000 Hz
     decimateBy = sampleRate / 1000;
-    assert(decimateBy > 0);
-    assert(INPUT_BLOCK_SAMPLES < decimateBy * DECIMATED_BLOCK_SAMPLES);
+    if ((decimateBy <= 0) || (decimateBy * DECIMATED_BLOCK_SAMPLES < INPUT_BLOCK_SAMPLES))
+    {
+        ST_THROW_RT_ERROR("Too small samplerate");
+    }
 
     // Calculate window length & starting item according to desired min & max bpms
     windowLen = (60 * sampleRate) / (decimateBy * MIN_BPM);
openSUSE Build Service is sponsored by