FIx out of bound in __readData

This commit is contained in:
Ralty
2025-08-03 15:22:21 +07:00
parent c5918aaa07
commit 1a336e6343
+1 -1
View File
@@ -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;