diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-10 14:00:26 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-11 12:39:01 +0100 |
commit | 1e47ef600d7fb7c763f4ba1aef104fcf3f59cfd8 (patch) | |
tree | bb012193634c945d62a46a40b8e79b3c13f40c62 /libavfilter/dnn | |
parent | 0e078c6cfa078475517cc07a500032a42a523587 (diff) |
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@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavfilter/dnn')
-rw-r--r-- | libavfilter/dnn/dnn_backend_native.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |