[FFmpeg-cvslog] truemotion1: check the header size

Anton Khirnov git at videolan.org
Fri Mar 7 03:59:08 CET 2014


ffmpeg | branch: release/1.1 | Anton Khirnov <anton at khirnov.net> | Thu Nov 28 10:54:35 2013 +0100| [13fd80837f85f7d33bfb857ce9a3f33455cf4b3d] | committer: Reinhard Tartler

truemotion1: check the header size

Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable at libav.org
(cherry picked from commit 2240e2078d53d3cfce8ff1dda64e58fa72038602)

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

 libavcodec/truemotion1.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index 63cd05b..2421dac 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -322,6 +322,11 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
         return -1;
     }
 
+    if (header.header_size + 1 > s->size) {
+        av_log(s->avctx, AV_LOG_ERROR, "Input packet too small.\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     /* unscramble the header bytes with a XOR operation */
     for (i = 1; i < header.header_size; i++)
         header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];



More information about the ffmpeg-cvslog mailing list