ffmpeg | branch: master | Andreas Rheinhardt <[email protected]> | 
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 <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>

> 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;
     }

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to