diff mbox series

[FFmpeg-devel,3/3] lavfi/vf_dnn_processing.c: fix CID 1460603

Message ID 20210511074112.18552-3-yejun.guo@intel.com
State Accepted
Commit 4718d74c5888457bca49aa02187841905e259d57
Headers show
Series [FFmpeg-devel,1/3] lavfi/dnn/dnn_io_proc.c: Fix Out-of-bounds access (ARRAY_VS_SINGLETON) | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate fail Make fate failed
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Guo, Yejun May 11, 2021, 7:41 a.m. UTC
CID 1460603 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)
---
 libavfilter/vf_dnn_processing.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Guo, Yejun May 17, 2021, 1:50 a.m. UTC | #1
> -----Original Message-----
> From: Guo, Yejun <yejun.guo@intel.com>
> Sent: 2021年5月11日 15:41
> To: ffmpeg-devel@ffmpeg.org
> Cc: Guo, Yejun <yejun.guo@intel.com>
> Subject: [PATCH 3/3] lavfi/vf_dnn_processing.c: fix CID 1460603
> 
> CID 1460603 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)
> ---
>  libavfilter/vf_dnn_processing.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
> index e05d59a649..e1d9d24683 100644
> --- a/libavfilter/vf_dnn_processing.c
> +++ b/libavfilter/vf_dnn_processing.c
> @@ -225,6 +225,9 @@ static int copy_uv_planes(DnnProcessingContext *ctx,
> AVFrame *out, const AVFrame
>          uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h);
>          for (int i = 1; i < 3; ++i) {
>              int bytewidth = av_image_get_linesize(in->format, in->width,
> i);
> +            if (bytewidth < 0) {
> +                return AVERROR(EINVAL);
> +            }
>              av_image_copy_plane(out->data[i], out->linesize[i],
>                                  in->data[i], in->linesize[i],
>                                  bytewidth, uv_height);
> --
will push tomorrow if there's no objection, thanks.
diff mbox series

Patch

diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
index e05d59a649..e1d9d24683 100644
--- a/libavfilter/vf_dnn_processing.c
+++ b/libavfilter/vf_dnn_processing.c
@@ -225,6 +225,9 @@  static int copy_uv_planes(DnnProcessingContext *ctx, AVFrame *out, const AVFrame
         uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h);
         for (int i = 1; i < 3; ++i) {
             int bytewidth = av_image_get_linesize(in->format, in->width, i);
+            if (bytewidth < 0) {
+                return AVERROR(EINVAL);
+            }
             av_image_copy_plane(out->data[i], out->linesize[i],
                                 in->data[i], in->linesize[i],
                                 bytewidth, uv_height);