From patchwork Mon Oct 12 12:37:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1380891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=U0NOOl6w; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C8ytN4vPrz9sS8 for ; Mon, 12 Oct 2020 23:39:40 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=PHR9eoDEfmD8C1nEvuE0PwkDfZKxdnQ9XeUBn4LItN0=; b=U0NOOl6wSLHuW12LxsRj5nTYy9 olegh0i1ga6FMGL9ViyC08uIwgTBMEk6Tk3TNHNEKSPr51EjXafiuAZZ/Rm293qUZJtLtzaG9c9Uf snNDpqKSgLjh4iI6AVxOFS4vz7eiS6HpcZtWdg5j/xspQEuEWCFWB96AG+IA8fRY/OymeP408v0Oj Jn5I7fwzuIh2sSmtbc9P0AqDrqmivHwQHft+/9/jimWMAEFCQDJNi3t/t2hKrjrz6AOwNvmddtra+ jRbFirAO4Pa5aAeMwMyP6/bbcwgvhesF953evDD34rnTPaCYNRsht3oiz9G6FaIHwH5PGRWSUae3P 7gbvKT3Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kRx5A-0002rF-VP; Mon, 12 Oct 2020 12:37:41 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kRx4z-0002m0-B6 for openwrt-devel@lists.openwrt.org; Mon, 12 Oct 2020 12:37:31 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 4ACCE35DA; Mon, 12 Oct 2020 14:37:25 +0200 (CEST) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 7a37f9d7; Mon, 12 Oct 2020 14:37:07 +0200 (CEST) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH cgi-io 00/12] fixes and improvements Date: Mon, 12 Oct 2020 14:37:06 +0200 Message-Id: <20201012123718.25623-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201012_083729_650763_CA758414 X-CRM114-Status: GOOD ( 17.51 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Hi, this patch series adds the basic building blocks of automatic CI unit testing, fuzzing and fixing all discovered issues. Cheers, Petr Petr Štetiar (12): Fix warnings reported by clang-10 static analyzer Fix possible NULL dereference Fix clang compiler errors Refactor utility functions into static library Add fuzzing of multipart_parser Add fuzzing of utility functions Fix off-by-one in postdecode_fields Add .gitignore Add initial GitLab CI support Disable session ACLs during unit testing tests: add cgi-io built with clang sanitizers tests: add cram based unit tests .gitignore | 1 + .gitlab-ci.yml | 7 + CMakeLists.txt | 25 +- main.c | 296 ++---------------- multipart_parser.c | 3 + tests/CMakeLists.txt | 6 + tests/cram/CMakeLists.txt | 25 ++ tests/cram/test-cases/cgi-exec-01.txt | 1 + tests/cram/test-cases/cgi-exec-02.txt | 1 + tests/cram/test-cases/cgi-exec-03.txt | 1 + tests/cram/test-san_cgi-exec.t | 30 ++ tests/cram/test_cgi-exec.t | 30 ++ tests/fuzz-multipart-parser/CMakeLists.txt | 18 ++ tests/fuzz-multipart-parser/corpus/.keep | 0 tests/fuzz-multipart-parser/dict/parser.dict | 10 + tests/fuzz-multipart-parser/inputs/input1.txt | 6 + tests/fuzz-multipart-parser/inputs/input2.txt | 10 + .../test-fuzz-multipart-parser.c | 43 +++ tests/fuzz/CMakeLists.txt | 18 ++ .../58668e7669fd564d99db5d581fcdb6a5618440b5 | 1 + .../5ba93c9db0cff93f52b521d7420e43f6eda2784f | Bin 0 -> 1 bytes .../adc83b19e793491b1c6ea0fd8b46cd9f32e592fc | 1 + ...h-9adc1b00fe9189d66d3bfd8b7759b003cf3f5427 | Bin 0 -> 191 bytes ...h-c1e3b9cd71f83cc0de5ab4c0e3db39316cd5c6c0 | 1 + tests/fuzz/test-fuzz.c | 43 +++ util.c | 286 +++++++++++++++++ util.h | 12 + 27 files changed, 598 insertions(+), 277 deletions(-) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 tests/CMakeLists.txt create mode 100644 tests/cram/CMakeLists.txt create mode 100644 tests/cram/test-cases/cgi-exec-01.txt create mode 100644 tests/cram/test-cases/cgi-exec-02.txt create mode 100644 tests/cram/test-cases/cgi-exec-03.txt create mode 100644 tests/cram/test-san_cgi-exec.t create mode 100644 tests/cram/test_cgi-exec.t create mode 100644 tests/fuzz-multipart-parser/CMakeLists.txt create mode 100644 tests/fuzz-multipart-parser/corpus/.keep create mode 100644 tests/fuzz-multipart-parser/dict/parser.dict create mode 100644 tests/fuzz-multipart-parser/inputs/input1.txt create mode 100644 tests/fuzz-multipart-parser/inputs/input2.txt create mode 100644 tests/fuzz-multipart-parser/test-fuzz-multipart-parser.c create mode 100644 tests/fuzz/CMakeLists.txt create mode 100644 tests/fuzz/corpus/58668e7669fd564d99db5d581fcdb6a5618440b5 create mode 100644 tests/fuzz/corpus/5ba93c9db0cff93f52b521d7420e43f6eda2784f create mode 100644 tests/fuzz/corpus/adc83b19e793491b1c6ea0fd8b46cd9f32e592fc create mode 100644 tests/fuzz/corpus/crash-9adc1b00fe9189d66d3bfd8b7759b003cf3f5427 create mode 100644 tests/fuzz/corpus/crash-c1e3b9cd71f83cc0de5ab4c0e3db39316cd5c6c0 create mode 100644 tests/fuzz/test-fuzz.c create mode 100644 util.c create mode 100644 util.h