[FFmpeg-cvslog] ffv1: Make sure at least one slice context is initialized

Martin Storsjö git at videolan.org
Thu Jan 16 22:08:49 CET 2014


ffmpeg | branch: release/0.10 | Martin Storsjö <martin at martin.st> | Mon Sep 16 21:46:50 2013 +0300| [2b71a7884196413d39b90549e58c4488a8f83953] | committer: Luca Barbato

ffv1: Make sure at least one slice context is initialized

This avoids crashes when initializing the range coder for
the first slice context.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit b1db33159fdc2da4bdd8c75e4ff9a7dd0ef2f0c2)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavcodec/ffv1.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 8a6f33f..917f40d 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -708,6 +708,10 @@ static av_cold int init_slice_contexts(FFV1Context *f){
     int i;
 
     f->slice_count= f->num_h_slices * f->num_v_slices;
+    if (f->slice_count <= 0) {
+        av_log(f->avctx, AV_LOG_ERROR, "Invalid number of slices\n");
+        return AVERROR(EINVAL);
+    }
 
     for(i=0; i<f->slice_count; i++){
         FFV1Context *fs= av_mallocz(sizeof(*fs));



More information about the ffmpeg-cvslog mailing list