Correctly use declared song count when parsing data
This commit is contained in:
@@ -475,8 +475,9 @@ function collectSongPositions(data: Uint8Array): SongPosition[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const availablePositions = Math.max(0, data.length - firstSongPositionOffset);
|
const availablePositions = Math.max(0, data.length - firstSongPositionOffset);
|
||||||
const songCount = Math.min(data[songCountOffset], 99, availablePositions);
|
const declaredSongCount = data[songCountOffset];
|
||||||
if (songCount === 1 && data[firstSongPositionOffset] === 1) {
|
const songCount = Math.min(declaredSongCount, 99, availablePositions);
|
||||||
|
if (declaredSongCount === 1 && data[firstSongPositionOffset] === 1) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user