From patchwork Wed Mar 10 21:54:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26321 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7CEDE44B799 for ; Wed, 10 Mar 2021 23:55:45 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6BE0268AB37; Wed, 10 Mar 2021 23:55:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3064B68AAEB for ; Wed, 10 Mar 2021 23:55:36 +0200 (EET) Received: by mail-ed1-f54.google.com with SMTP id dm26so4494edb.12 for ; Wed, 10 Mar 2021 13:55:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=HbgVwmhEZOXC/fe3OjSEyt3/h2QEUlCZ2raJnIAgfhg=; b=nun08Av97mUbJMnGZHNJbC9axB9oIEA8s2u57cReSSJN5yKjxyKr5XTCNroRQKD40O jwAXbQ0tSMwwW4DwJ8/HkiIJbFFSU7a+mz52ut9NYVPl2XpI+3RUt+l7Oiuv5/E1IxAS TcxhzVi7EUVc+mJ00IudRCkgnmpOg/Nv63wN+uZ80u44u5g3TFspHFru8PUTF4mFMMh/ uIwhfONUJaeCv++OVNwWkHMRL6zr6zCKS4LDl8OsVMOYtJ1qIml7RNbDaa1HCHrL9LIA He7e3fU35e58xVQ4kSe8HBYqVQ8Hfz4vJasLDYhrtiupZMUNwZmtM8fy3hI0AbEGAIpF qeUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=HbgVwmhEZOXC/fe3OjSEyt3/h2QEUlCZ2raJnIAgfhg=; b=n2JkWQPHeqs2TG5y9en/690F4QN5ZNQBNufzqwcvX2JjyeAbIAaMC7vWDCEjiF+hQ0 +7JLUJmeVHSp3oH/HIyyzzwNAjJU590BQdOH9toWB1f4VdiRihRqcrnRVbUFehClwcIX jOjfOQtJRVVygodZA6rjKO56L++lHQdmgKBSafiuPiKwit1xmI6Ho09OLVw05doSIhBF 8UteN6raQ7sJzevOnMNbyuOqpP7JKStOtw+iwCzhEpGlOcIpvm/nka7yne4s15Pgx6bA B8MY0AbSdzmHPJXwuRh40JxFp6ixets3G50bp9S/KQ+qhIaHh3uIfT8kz6i6iWE1jVms QeQg== X-Gm-Message-State: AOAM530uO6E8j7zOQ7eh7JWCrZIqKWKKZzjtOt0G1ovOQUvmhMqbVZK5 A77fzsiRXN72ewT7/iFCCSGg7QKALDE= X-Google-Smtp-Source: ABdhPJzbjxbRdtcNgpv7lr0g3SaJfMh+qEIHThS4EdqPF0b6yjRizUA/BImS2TpezR0zsnk66i/J3g== X-Received: by 2002:a50:e702:: with SMTP id a2mr5573210edn.3.1615413335637; Wed, 10 Mar 2021 13:55:35 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id m10sm351993ejx.10.2021.03.10.13.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 13:55:35 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Mar 2021 22:54:35 +0100 Message-Id: <20210310215446.1396386-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210310010601.1142819-1-andreas.rheinhardt@gmail.com> References: <20210310010601.1142819-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/23] dnn/dnn_backend_native: Don't use asserts for checks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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. Signed-off-by: Andreas Rheinhardt --- get_input_native() only asserts this for input operands; so it might be that the check below should also check for this (depending upon whether 1 is a valid value for output operands). 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 fd1f9e299d..b3c41af94e 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -231,6 +231,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->dims[0] != 1) + goto fail; oprd->isNHWC = 1; }