Module: libav
Branch: release/0.8
Commit: de0e442e9d6754ae1ad56a8372f45f6aa5e51012

Author:    Anton Khirnov <[email protected]>
Committer: Reinhard Tartler <[email protected]>
Date:      Thu Nov 28 10:54:35 2013 +0100

truemotion1: check the header size

Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:[email protected]
(cherry picked from commit 2240e2078d53d3cfce8ff1dda64e58fa72038602)
(cherry picked from commit 76b40a9bf93e387d98aa7dc02ec7a8d13f51722f)

---

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

diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index fcf6004..65a45d8 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -320,6 +320,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 */
     memset(header_buffer, 0, 128);
     for (i = 1; i < header.header_size; i++)

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to