Skip to content

Commit 7c8dd98

Browse files
committed
Fix __readStream out of bound
1 parent 4862455 commit 7c8dd98

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

source/funkin/backend/utils/AudioAnalyzer.hx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ final class AudioAnalyzer {
474474
var n = Math.floor((endPos - startPos) * __toBits);
475475
if (startPos >= time && startPos < backend.bufferTimes[backend.bufferSizes.length - 1] * 1000) {
476476
var pos = Math.floor((startPos - time) * __toBits), buf = backend.bufferDatas[i].buffer, size = backend.bufferSizes[i], c = 0;
477-
while (pos > size) {
477+
while (pos >= size) {
478478
if (++i >= backend.bufferSizes.length) {
479479
n = 0;
480480
break;
@@ -484,6 +484,7 @@ final class AudioAnalyzer {
484484
size = backend.bufferSizes[i];
485485
}
486486
pos -= pos % __sampleSize;
487+
n -= pos % __sampleSize;
487488

488489
while (n > 0) {
489490
callback(getByte(buf, pos, __wordSize), c);

0 commit comments

Comments
 (0)