From 18e210ea94c8268cb047d48e67432d26c3b7a1d0 Mon Sep 17 00:00:00 2001 From: Ariel Elkin Date: Sun, 29 Dec 2013 00:48:48 +0100 Subject: [PATCH 1/3] Update TapDelay.cpp --- src/TapDelay.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/TapDelay.cpp b/src/TapDelay.cpp index 67c2c64..9a0396b 100644 --- a/src/TapDelay.cpp +++ b/src/TapDelay.cpp @@ -67,11 +67,6 @@ void TapDelay :: setTapDelays( std::vector taps ) oStream_ << "TapDelay::setTapDelay: argument (" << taps[i] << ") greater than maximum!\n"; handleError( StkError::WARNING ); return; } - - if ( taps[i] < 0 ) { - oStream_ << "TapDelay::setDelay: argument (" << taps[i] << ") less than zero!\n"; - handleError( StkError::WARNING ); return; - } } if ( taps.size() != outPoint_.size() ) { From 4078d9309d0fd3ffeba8b3dc0085b74effca9b64 Mon Sep 17 00:00:00 2001 From: Ariel Elkin Date: Fri, 3 Jan 2014 03:34:34 +0100 Subject: [PATCH 2/3] prevent division by zero in FileRead::getRawInfo --- src/FileRead.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/FileRead.cpp b/src/FileRead.cpp index 32553d3..5b230d7 100644 --- a/src/FileRead.cpp +++ b/src/FileRead.cpp @@ -141,6 +141,10 @@ bool FileRead :: getRawInfo( const char *fileName, unsigned int nChannels, StkFo oStream_ << "FileRead: Could not stat RAW file (" << fileName << ")."; return false; } + if ( nChannels == 0 ) { + oStream_ << "FileRead: number of channels can't be 0 (" << fileName << ")."; + return false; + } // Rawwave files have no header and by default, are assumed to // contain a monophonic stream of 16-bit signed integers in @@ -155,6 +159,10 @@ bool FileRead :: getRawInfo( const char *fileName, unsigned int nChannels, StkFo else if ( format == STK_SINT16 ) sampleBytes = 2; else if ( format == STK_SINT32 || format == STK_FLOAT32 ) sampleBytes = 4; else if ( format == STK_FLOAT64 ) sampleBytes = 8; + else { + oStream_ << "FileRead: StkFormat " << format << " is invalid (" << fileName << ")."; + return false; + } fileSize_ = (long) filestat.st_size / sampleBytes / channels_; // length in frames From 80db57e79bc84c0be48463360fc88a8f2c6980c9 Mon Sep 17 00:00:00 2001 From: Ariel Elkin Date: Sun, 5 Jan 2014 20:19:27 +0000 Subject: [PATCH 3/3] FileRead::getMatInfo, fixed if-else block --- src/FileRead.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FileRead.cpp b/src/FileRead.cpp index 5b230d7..a58669c 100644 --- a/src/FileRead.cpp +++ b/src/FileRead.cpp @@ -622,7 +622,7 @@ bool FileRead :: getMatInfo( const char *fileName ) if ( fread(&rate, 1, 1, fd_) != 1 ) goto error; srate = (StkFloat) rate; } - if ( type == 2 ) { // UINT8 + else if ( type == 2 ) { // UINT8 unsigned char rate; if ( fread(&rate, 1, 1, fd_) != 1 ) goto error; srate = (StkFloat) rate;