From patchwork Fri Aug 21 11:47:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21797 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 1406944B1F8 for ; Fri, 21 Aug 2020 14:47:42 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E2F6068B5C2; Fri, 21 Aug 2020 14:47:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2E0568AAA0 for ; Fri, 21 Aug 2020 14:47:34 +0300 (EEST) Received: by mail-ej1-f67.google.com with SMTP id kq25so1956247ejb.3 for ; Fri, 21 Aug 2020 04:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ke1rNO9pDyFMguucGErgKSc+e9nKNa2++G5UuzOdMJ0=; b=P+4vptdNtzGObZ7u6ve5mz0JJr4A8/GmIYaeFLiXLx3aJ1MDpFHXGiUzM2LL3Oeiqc l8P6sL+yojpnUp2UNwyhzjwtMoRK3Jz5aofxel6+uJarcGgGApSqNhtShMMU6ASTOtnB r4VkFp7/bQF2qV4b4tZNdoV9zKtq5HFnSzLWVRI4oq/vEIGlEPpB6C69w/JpileeVshc gvkxBLDcAZ25+mWlw0ZP/8l0BzOLyBFNlmhNtx1qmm1Zy7y9036DFG1H+ZVqwemlBBt7 +0wDxLZpPjTRFAG5U0w/A099SL2iwAEAbGLNlAiXIGuee2BnEkg28ThrVBmuDbFIGE9/ 3J3g== 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:mime-version :content-transfer-encoding; bh=ke1rNO9pDyFMguucGErgKSc+e9nKNa2++G5UuzOdMJ0=; b=er25PnCj+sgXn2iwpPj+WBEf+1GgEWZNZL/PawjlDD/wzh6LXhtxigPwW1FccqvHDQ znVV5IZOQ7/88524n52A43xdJbLE2f8iF0Bzqi4dFYho5KW5bagzxVEerTlAqqus08zx IgwzrW/ToylMHOTvhBCrfJz8ptUafsm5Y1OZNa3bEzD/0jDz5jq6ZcdjjKj1dbMiP9W5 Y9DJFk4icHf9o66YG/OQg03pqMmkXT5Eel5x9nRQl+dZaHezIos/3lrJuDJYftAF9Fce FoXJyG/7hCmXr1YaNqEoJS1G34VqajTH4Z9+glzH8Yf1NjiOypQX0vGguaQL6kC4A2F/ Wfpw== X-Gm-Message-State: AOAM531qOqGxHjRbxTBIsw0HHrzefPJUbOlO2hL3tiBXBeOmP6zp4Xmc 6lgQB4loVJAq3Gt6LcNXR5cgwuV8ToQ= X-Google-Smtp-Source: ABdhPJxU7e2lXZbzHfPoFJXVlUzCuZv67LqijnNsbCevCGunb8PX6X2N/sMujLq93d3FhcRm+J3OLA== X-Received: by 2002:a17:906:9989:: with SMTP id af9mr2316126ejc.385.1598010453913; Fri, 21 Aug 2020 04:47:33 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id di5sm977017edb.16.2020.08.21.04.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 04:47:33 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Aug 2020 13:47:27 +0200 Message-Id: <20200821114727.29233-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] dnn_backend_native_layer_avgpool: Fix invalid assignment, use av_assert 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" dnn_execute_layer_avg_pool() contains the following line: assert(avgpool_params->padding_method = VALID); This statement contains an assignment where obviously a comparison was intended. Furthermore, *avgpool_params is const, so that the attempted assignment leads to a compilation failure if asserts are enabled (i.e. if DEBUG is defined which leads libavutil/internal.h to not define NDEBUG). Moreover, the enumeration constant VALID actually has the value 0, so that the assert would be triggered if a compiler compiles this with asserts enabled. Finally, the statement uses assert() directly instead of av_assert*(). All these errors have been fixed. Thanks to ubitux for providing a FATE-box [1] where DEBUG is defined. [1]: http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-ddebug Signed-off-by: Andreas Rheinhardt --- I was unsure which assert level to use and therefore simply opted for 0. libavfilter/dnn/dnn_backend_native_layer_avgpool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c index d745c35b4a..8d4d8db98c 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c +++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c @@ -91,7 +91,7 @@ int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operan output_height = ceil(height / (kernel_strides * 1.0)); output_width = ceil(width / (kernel_strides * 1.0)); } else { - assert(avgpool_params->padding_method = VALID); + av_assert0(avgpool_params->padding_method == VALID); height_end = height - avgpool_params->kernel_size + 1; width_end = width - avgpool_params->kernel_size + 1; height_radius = 0;