Message ID | tencent_8B5B0C35DF81EC34D73E1B57619C74E0D009@qq.com |
---|---|
State | Accepted |
Commit | f72d781339716ba5cb086f4043b8626cea814213 |
Headers | show |
Series | [FFmpeg-devel,v2,1/3] fftools/ffmpeg_filter: fix NULL pointer dereference | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Quoting Zhao Zhili (2023-12-19 16:37:03) > From: Zhao Zhili <zhilizhao@tencent.com> > > --- > fftools/ffmpeg_enc.c | 6 ++++++ > 1 file changed, 6 insertions(+) Ok.
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 57590a43a3..2a7fba0c51 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -206,6 +206,9 @@ int enc_open(void *opaque, const AVFrame *frame) switch (enc_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: + av_assert0(frame->format != AV_SAMPLE_FMT_NONE && + frame->sample_rate > 0 && + frame->ch_layout.nb_channels > 0); enc_ctx->sample_fmt = frame->format; enc_ctx->sample_rate = frame->sample_rate; ret = av_channel_layout_copy(&enc_ctx->ch_layout, &frame->ch_layout); @@ -220,6 +223,9 @@ int enc_open(void *opaque, const AVFrame *frame) break; case AVMEDIA_TYPE_VIDEO: { + av_assert0(frame->format != AV_PIX_FMT_NONE && + frame->width > 0 && + frame->height > 0); enc_ctx->width = frame->width; enc_ctx->height = frame->height; enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio =
From: Zhao Zhili <zhilizhao@tencent.com> --- fftools/ffmpeg_enc.c | 6 ++++++ 1 file changed, 6 insertions(+)