aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-05-05 01:51:59 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-07-12 22:49:33 +0200
commit9af348bd1aa41ea10d6719c56ed2b4eda97642f3 (patch)
treea186237c032bd449e1e4d256235802a5b9d6804d /libavcodec
parented34b0c54ebdce7f741d9fb6a9ac11a1816df59c (diff)
downloadffmpeg-9af348bd1aa41ea10d6719c56ed2b4eda97642f3.tar.gz
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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/flac_parser.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 47904d515a..d9c47801f8 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -518,6 +518,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;