From 7560501414f1e7e699a80a97e379a5d37fde4eb4 Mon Sep 17 00:00:00 2001 From: oparviai Date: Mon, 9 Nov 2009 17:27:50 +0000 Subject: [PATCH] Bugfix: Fixed variable initialization to avoid segment fault possibility due to negative array indexing in quick seek algorithm in presence of worst-case correlations. --- README.html | 1 + source/SoundTouch/TDStretch.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.html b/README.html index f37841e..2c3c41d 100644 --- a/README.html +++ b/README.html @@ -701,6 +701,7 @@ SoundTouch v1.3.1:

  • Jason Garland
  • Takashi Iwai
  • Paulo Pizarro
  • +
  • RJ Ryan
  • John Sheehy
  • Moral greetings to all other contributors and users also!

    diff --git a/source/SoundTouch/TDStretch.cpp b/source/SoundTouch/TDStretch.cpp index 6947ae8..53d1d6f 100644 --- a/source/SoundTouch/TDStretch.cpp +++ b/source/SoundTouch/TDStretch.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include "STTypes.h" @@ -306,7 +307,7 @@ int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) // Slopes the amplitudes of the 'midBuffer' samples precalcCorrReferenceStereo(); - bestCorr = INT_MIN; + bestCorr = FLT_MIN; bestOffs = 0; // Scans for the best correlation value by testing each possible position @@ -350,8 +351,8 @@ int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) // Slopes the amplitude of the 'midBuffer' samples precalcCorrReferenceStereo(); - bestCorr = INT_MIN; - bestOffs = 0; + bestCorr = FLT_MIN; + bestOffs = _scanOffsets[0][0]; corrOffset = 0; tempOffset = 0; @@ -410,7 +411,7 @@ int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) // Slopes the amplitude of the 'midBuffer' samples precalcCorrReferenceMono(); - bestCorr = INT_MIN; + bestCorr = FLT_MIN; bestOffs = 0; // Scans for the best correlation value by testing each possible position @@ -456,8 +457,8 @@ int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) // Slopes the amplitude of the 'midBuffer' samples precalcCorrReferenceMono(); - bestCorr = INT_MIN; - bestOffs = 0; + bestCorr = FLT_MIN; + bestOffs = _scanOffsets[0][0]; corrOffset = 0; tempOffset = 0;