From 87e1955bcf76c2d53e9ba570b29bab356d91281f Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Tue, 22 Sep 2020 13:09:33 +0800 Subject: [PATCH] Fix compare logic. --- src/modules/sound/SoundData.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/sound/SoundData.cpp b/src/modules/sound/SoundData.cpp index 9bbc76dd7..cbf127242 100644 --- a/src/modules/sound/SoundData.cpp +++ b/src/modules/sound/SoundData.cpp @@ -267,9 +267,9 @@ void SoundData::copyFrom(const SoundData *src, int srcStart, int count, int dstS size_t srcBytesPerSample = (size_t) src->channels * src->bitDepth/8; // Check range - if (dstStart < 0 || (dstStart+count) * bytesPerSample >= size) + if (dstStart < 0 || (dstStart+count) * bytesPerSample > size) throw love::Exception("Destination out-of-range!"); - if (srcStart < 0 || (srcStart+count) * srcBytesPerSample >= src->size) + if (srcStart < 0 || (srcStart+count) * srcBytesPerSample > src->size) throw love::Exception("Source out-of-range!"); if (bitDepth != src->bitDepth)