[FFmpeg-cvslog] avcodec/flac_parser: Assert that we do not overrun the link_penalty array

Michael Niedermayer git at videolan.org
Wed Jul 24 17:50:05 EEST 2024


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Sun May  5 01:51:59 2024 +0200| [37cb93097afb7b8642eac5fd1968947bc509a02a] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 9af348bd1aa41ea10d6719c56ed2b4eda97642f3)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37cb93097afb7b8642eac5fd1968947bc509a02a
---

 libavcodec/flac_parser.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index b13b3b646a..c423398139 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -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;



More information about the ffmpeg-cvslog mailing list