From 7c8dd987ddec1f2da646eb43b2164b59a7e0ef18 Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Thu, 7 Aug 2025 20:00:12 +0700 Subject: [PATCH] Fix __readStream out of bound --- source/funkin/backend/utils/AudioAnalyzer.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/utils/AudioAnalyzer.hx b/source/funkin/backend/utils/AudioAnalyzer.hx index eccd5a4d..174f148c 100644 --- a/source/funkin/backend/utils/AudioAnalyzer.hx +++ b/source/funkin/backend/utils/AudioAnalyzer.hx @@ -474,7 +474,7 @@ final class AudioAnalyzer { var n = Math.floor((endPos - startPos) * __toBits); if (startPos >= time && startPos < backend.bufferTimes[backend.bufferSizes.length - 1] * 1000) { var pos = Math.floor((startPos - time) * __toBits), buf = backend.bufferDatas[i].buffer, size = backend.bufferSizes[i], c = 0; - while (pos > size) { + while (pos >= size) { if (++i >= backend.bufferSizes.length) { n = 0; break; @@ -484,6 +484,7 @@ final class AudioAnalyzer { size = backend.bufferSizes[i]; } pos -= pos % __sampleSize; + n -= pos % __sampleSize; while (n > 0) { callback(getByte(buf, pos, __wordSize), c);