1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/flac_parser: Assert that we do not overrun the link_penalty array

Helps: CID1454676 Out-of-bounds read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9af348bd1a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-05-05 01:51:59 +02:00
parent 11cdd99585
commit bc5f841688
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -359,6 +359,8 @@ static int check_header_mismatch(FLACParseContext *fpc,
for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS && curr != child; i++)
curr = curr->next;
av_assert0(i < FLAC_MAX_SEQUENTIAL_HEADERS);
if (header->link_penalty[i] < FLAC_HEADER_CRC_FAIL_PENALTY ||
header->link_penalty[i] == FLAC_HEADER_NOT_PENALIZED_YET) {
FLACHeaderMarker *start, *end;