avcodec/truemotion1: Check for even width
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 1 Sep 2015 02:57:22 +0000 (04:57 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 1 Sep 2015 03:15:04 +0000 (05:15 +0200)
Fixes out of array access
Fixes: 87196d8bbc633629fc9dd851fce73e70/asan_heap-oob_26f6853_862_cov_585961513_sonic3dblast_intro-partial.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/truemotion1.c

index b52a369..eed3a37 100644 (file)
@@ -402,6 +402,10 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
         new_pix_fmt = AV_PIX_FMT_RGB555; // RGB565 is supported as well
 
     s->w >>= width_shift;
+    if (s->w & 1) {
+        avpriv_request_sample(s->avctx, "Frame with odd width");
+        return AVERROR_PATCHWELCOME;
+    }
 
     if (s->w != s->avctx->width || s->h != s->avctx->height ||
         new_pix_fmt != s->avctx->pix_fmt) {