summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/ffv1.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 378b55b236..a31f2786ee 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));