[FFmpeg-cvslog] dnn/dnn_backend_native: Don't use asserts for checks
Andreas Rheinhardt
git at videolan.org
Thu Mar 11 15:04:52 EET 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Mar 10 14:00:26 2021 +0100| [1e47ef600d7fb7c763f4ba1aef104fcf3f59cfd8] | committer: Andreas Rheinhardt
dnn/dnn_backend_native: Don't use asserts for checks
asserts should not be used instead of ordinary input checks.
Yet the native DNN backend did it: get_input_native() asserted that
the first dimension was one, despite this value coming directly from
the input file without having been sanitized.
Reviewed-by: Guo, Yejun <yejun.guo at intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e47ef600d7fb7c763f4ba1aef104fcf3f59cfd8
---
libavfilter/dnn/dnn_backend_native.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c
index 828dcf8b37..c7a2ad223a 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -232,6 +232,8 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f
oprd->dims[dim] = (int32_t)avio_rl32(model_file_context);
dnn_size += 4;
}
+ if (oprd->type == DOT_INPUT && oprd->dims[0] != 1)
+ goto fail;
oprd->isNHWC = 1;
}
More information about the ffmpeg-cvslog
mailing list