[FFmpeg-devel] [PATCH] dnn_backend_native: Add overflow check for length calculation.

Guo, Yejun yejun.guo at intel.com
Mon Jul 6 17:18:39 EEST 2020



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Reimar
> D?ffinger
> Sent: 2020年7月6日 15:32
> To: ffmpeg-devel at ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH] dnn_backend_native: Add overflow check for
> length calculation.
> 
> We should not silently allocate an incorrect sized buffer.
> Fixes trac issue #8718.
> TODO1: calculate_operand_dims_count is almost identical code, should they be
> merged and its usages check for overflow?
> TODO2: the -1 return value seems questionable to me, but is aligned with the
> return value used for malloc failure.
> Probably both ought to be changed to AVERROR(ENOMEM).
> 
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
>  libavfilter/dnn/dnn_backend_native.c                   | 10 +++++++++-
>  libavfilter/dnn/dnn_backend_native.h                   |  2 ++
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c      |  2 ++
>  libavfilter/dnn/dnn_backend_native_layer_depth2space.c |  2 ++
> libavfilter/dnn/dnn_backend_native_layer_mathbinary.c  |  2 ++
>  libavfilter/dnn/dnn_backend_native_layer_mathunary.c   |  2 ++
>  libavfilter/dnn/dnn_backend_native_layer_maximum.c     |  2 ++
>  libavfilter/dnn/dnn_backend_native_layer_pad.c         |  2 ++
>  8 files changed, 23 insertions(+), 1 deletion(-)

thanks, LGTM, will push soon.

I'll modify a little to remove the TODO in commit log, and welcome the new patches.

I'll also cherry-pick to release 4.3


More information about the ffmpeg-devel mailing list