diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-16 21:46:50 +0300 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-10-04 03:26:27 +0200 |
commit | 3706c229920115f022876ef07b16217dce504db6 (patch) | |
tree | e640d48c9814d41be56ce164cb32b7e766c83383 | |
parent | eac1c3f384eab770d42468f4f244156c1735701d (diff) | |
download | ffmpeg-3706c229920115f022876ef07b16217dce504db6.tar.gz |
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@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit b1db33159fdc2da4bdd8c75e4ff9a7dd0ef2f0c2)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r-- | libavcodec/ffv1.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 682d111c0c..f6d9eaf276 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -194,6 +194,10 @@ av_cold int ffv1_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)); |