mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-11-06 05:17:42 +00:00
avcodec/huffyuvenc: reject frames too small for the median predictor
SEGV Replicated through UnModified FFmpeg with ASAN (width 2) Out of array read Replicated through API with ASAN (heights 1 and 2) Fixes: out of array access Fixes: m5jVlJdov0Lp Fixes: AISLE-2026-0150-00558 Found-by: Joshua Rogers (AISLE) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
1 parent
439b452f9f
commit
45f98d0819
1 file changed
+7
@@ -370,6 +370,13 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (s->predictor == MEDIAN && s->version <= 2 &&
|
||||
(avctx->width < 4 ||
|
||||
AV_CEIL_RSHIFT(avctx->height, s->chroma_v_shift) < 2 + s->interlaced)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Frame too small for the median predictor\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
avctx->extradata[0] = s->predictor | (s->decorrelate << 6);
|
||||
avctx->extradata[2] = s->interlaced ? 0x10 : 0x20;
|
||||
if (s->context)
|
||||
|
||||
Reference in new issue
Block a user