diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index d2bfee784fb36155680d72164546e4672c2765c2..5eadb6b158648c4ae796fd37617c6e94e5ff87dd 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -717,7 +717,7 @@ static int read_header(FFV1Context *f) } else { const uint8_t *p = c->bytestream_end; for (f->slice_count = 0; - f->slice_count < MAX_SLICES && 3 < p - c->bytestream_start; + f->slice_count < MAX_SLICES && 3 + 5*!!f->ec < p - c->bytestream_start; f->slice_count++) { int trailer = 3 + 5*!!f->ec; int size = AV_RB24(p-trailer);