From 05faede8f6602b7b71d71fd965276225a986fb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= Date: Wed, 28 Jul 2021 13:06:25 +0200 Subject: [PATCH] Add a regression test for rhbz#1959570 The bug was a segmentation fault in filehash58 probe which happened in openscap-1.3.3-6.el8_3. The bug was fixed by https://github.com/OpenSCAP/openscap/pull/1779 and this patch adds a very small test. --- tests/probes/filehash58/CMakeLists.txt | 1 + .../probes/filehash58/rhbz1959570_segfault.sh | 19 +++++++++ .../rhbz1959570_segfault_reproducer.xml | 39 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100755 tests/probes/filehash58/rhbz1959570_segfault.sh create mode 100644 tests/probes/filehash58/rhbz1959570_segfault_reproducer.xml diff --git a/tests/probes/filehash58/CMakeLists.txt b/tests/probes/filehash58/CMakeLists.txt index b26d8171fb..cdec0792eb 100644 --- a/tests/probes/filehash58/CMakeLists.txt +++ b/tests/probes/filehash58/CMakeLists.txt @@ -1,3 +1,4 @@ if(ENABLE_PROBES_INDEPENDENT) add_oscap_test("test_probes_filehash58.sh") + add_oscap_test("rhbz1959570_segfault.sh") endif() diff --git a/tests/probes/filehash58/rhbz1959570_segfault.sh b/tests/probes/filehash58/rhbz1959570_segfault.sh new file mode 100755 index 0000000000..0c32cc79f1 --- /dev/null +++ b/tests/probes/filehash58/rhbz1959570_segfault.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Copyright 2021 Red Hat Inc., Durham, North Carolina. +# All Rights Reserved. +# +# OpenSCAP Probes Test Suite. +# +# Authors: +# Jan Černý, + +set -e -o pipefail +. $builddir/tests/test_common.sh + +# Test Cases + +stderr="$(mktemp)" +$OSCAP oval eval --id oval:x:def:1 "$srcdir/rhbz1959570_segfault_reproducer.xml" 2> "$stderr" +[ ! -s "$stderr" ] +rm "$stderr" diff --git a/tests/probes/filehash58/rhbz1959570_segfault_reproducer.xml b/tests/probes/filehash58/rhbz1959570_segfault_reproducer.xml new file mode 100644 index 0000000000..4b3fc4863a --- /dev/null +++ b/tests/probes/filehash58/rhbz1959570_segfault_reproducer.xml @@ -0,0 +1,39 @@ + + + + jcerny + 1 + 5.11 + 2021-07-28T07:40:55 + + + + + title + description + + + + + + + + + + + + + + + /etc/os-release + SHA-256 + + + + + /etc/os-release + SHA-256 + 6488c757642cd493da09dd78ee27f039711a1ad79039900970553772fd2106af + + +