[FFmpeg-cvslog] 4xmdemux: Check chunk size

Michael Niedermayer git at videolan.org
Fri May 11 22:45:40 CEST 2012


ffmpeg | branch: release/0.5 | Michael Niedermayer <michaelni at gmx.at> | Mon Apr 16 14:30:33 2012 +0200| [5e3cd42b6d0760d35fb0dec62ad13f09dee94448] | committer: Michael Niedermayer

4xmdemux: Check chunk size

Fixes over reading the header array

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 474e31c904f766b6989fe614c3fb093e697c847f)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/4xm.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 631f821..d0fd312 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -127,6 +127,10 @@ static int fourxm_read_header(AVFormatContext *s,
     for (i = 0; i < header_size - 8; i++) {
         fourcc_tag = AV_RL32(&header[i]);
         size = AV_RL32(&header[i + 4]);
+        if (size > header_size - i - 8 && (fourcc_tag == vtrk_TAG || fourcc_tag == strk_TAG)) {
+            av_log(s, AV_LOG_ERROR, "chunk larger than array %d>%d\n", size, header_size - i - 8);
+            return AVERROR_INVALIDDATA;
+        }
 
         if (fourcc_tag == std__TAG) {
             fourxm->fps = av_int2flt(AV_RL32(&header[i + 12]));



More information about the ffmpeg-cvslog mailing list