From 1a336e63433781870b6d8564189c5fb27c2ed233 Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Sun, 3 Aug 2025 15:22:21 +0700 Subject: [PATCH] FIx out of bound in __readData --- source/funkin/backend/utils/AudioAnalyzer.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/backend/utils/AudioAnalyzer.hx b/source/funkin/backend/utils/AudioAnalyzer.hx index 22d41862..24bb2138 100644 --- a/source/funkin/backend/utils/AudioAnalyzer.hx +++ b/source/funkin/backend/utils/AudioAnalyzer.hx @@ -448,7 +448,7 @@ final class AudioAnalyzer { } inline function __readData(startPos:Float, endPos:Float, callback:AudioAnalyzerCallback) { - var pos = Math.floor(startPos * __toBits), end = Math.floor(endPos * __toBits), c = 0; + var pos = Math.floor(startPos * __toBits), end = Math.min(Math.floor(endPos * __toBits), buffer.data.buffer.length), c = 0; pos -= pos % __sampleSize; end -= end % __sampleSize;