[FFmpeg-cvslog] avformat/aadec: Check toc_size to contain the minimum to demuxer uses

Michael Niedermayer git at videolan.org
Sun Jul 5 20:50:23 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Tue Apr  7 12:04:25 2020 +0200| [104e38464bffb9e0a329fd399b08e7e13f79ff6e] | committer: Michael Niedermayer

avformat/aadec: Check toc_size to contain the minimum to demuxer uses

Fixes: out of array access
Fixes: stack-buffer-overflow-READ-0x0831fff1

Found-by: GalyCannon <galycannon at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit daa2482871dffa9af12fa6d874a3d2dedd73f42e)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/aadec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 16c47950e4..654fabbf33 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -85,7 +85,7 @@ static int aa_read_header(AVFormatContext *s)
     avio_skip(pb, 4); // magic string
     toc_size = avio_rb32(pb); // TOC size
     avio_skip(pb, 4); // unidentified integer
-    if (toc_size > MAX_TOC_ENTRIES)
+    if (toc_size > MAX_TOC_ENTRIES || toc_size < 2)
         return AVERROR_INVALIDDATA;
     for (i = 0; i < toc_size; i++) { // read TOC
         avio_skip(pb, 4); // TOC entry index



More information about the ffmpeg-cvslog mailing list