soundtouch/0004-Improved-WavFile-heade...

35 lines
1.1 KiB
Diff

From 46531e5b92dd80dd9a7947463d6224fc7cb21967 Mon Sep 17 00:00:00 2001
From: olli <oparviai@iki.fi>
Date: Mon, 13 Aug 2018 19:42:58 +0300
Subject: [PATCH 4/4] Improved WavFile header/fact not-too-small check
---
source/SoundStretch/WavFile.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source/SoundStretch/WavFile.cpp b/source/SoundStretch/WavFile.cpp
index 3421bca..9d90b8a 100644
--- a/source/SoundStretch/WavFile.cpp
+++ b/source/SoundStretch/WavFile.cpp
@@ -522,7 +522,7 @@ int WavInFile::readHeaderBlock()
nDump = nLen - ((int)sizeof(header.format) - 8);
// verify that header length isn't smaller than expected structure
- if (nDump < 0) return -1;
+ if ((nLen < 0) || (nDump < 0)) return -1;
header.format.format_len = nLen;
@@ -567,7 +567,7 @@ int WavInFile::readHeaderBlock()
nDump = nLen - ((int)sizeof(header.fact) - 8);
// verify that fact length isn't smaller than expected structure
- if (nDump < 0) return -1;
+ if ((nLen < 0) || (nDump < 0)) return -1;
header.fact.fact_len = nLen;
--
2.18.0