[FFmpeg-cvslog] rv34: check that subsequent slices have the same type as first one.

Kostya Shishkov git at videolan.org
Wed Sep 21 21:08:35 CEST 2011


ffmpeg | branch: release/0.8 | Kostya Shishkov <kostya.shishkov at gmail.com> | Mon Sep 12 11:39:53 2011 +0200| [ad6177e52c86343b1a9043e56525d01d070a2009] | committer: Michael Niedermayer

rv34: check that subsequent slices have the same type as first one.

This prevents some crashes when corrupted bitstream reports e.g. P-type
slice in I-frame. Official RealVideo decoder demands all slices to be
of the same type too.

Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit 23a1f0c59241465ba30103388029a7afc0ead909)

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

 libavcodec/rv34.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 8cec363..f0f472d 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1305,6 +1305,13 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
             r->next_pts = r->cur_pts;
         }
         s->mb_x = s->mb_y = 0;
+    } else {
+        int slice_type = r->si.type ? r->si.type : AV_PICTURE_TYPE_I;
+
+        if (slice_type != s->pict_type) {
+            av_log(s->avctx, AV_LOG_ERROR, "Slice type mismatch\n");
+            return AVERROR_INVALIDDATA;
+        }
     }
 
     r->si.end = end;



More information about the ffmpeg-cvslog mailing list