mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-24 02:09:03 +03:00
avcodec/encode: reject video frames that do not match the encoder
Fixes: out of array read Fixes: DdI1HfjoEG1l Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24765 Out of array read Replicated through UnModified FFmpeg with ASAN
This commit is contained in:
committed by
michaelni
parent
81f2ea37e4
commit
254cebc4e8
@@ -518,6 +518,15 @@ static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!(avctx->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE)) {
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src->format);
|
||||
|
||||
if (!(desc && desc->flags & AV_PIX_FMT_FLAG_HWACCEL) &&
|
||||
(src->format != avctx->pix_fmt ||
|
||||
src->width < avctx->width || src->height < avctx->height)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Frame size or pixel format does not match the encoder\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
ret = av_frame_ref(dst, src);
|
||||
|
||||
Reference in New Issue
Block a user