From 86f0ebc21eedd67fa058e6621342472e8e60f601 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Wed, 27 Sep 2023 14:23:27 +0200 Subject: [PATCH] ci: add .csmock-kfp.js for known csmock false positives The gcc warns about the array subscript to be out of bounds when using _vvalue_data_prep even though there's an assertion checking for the array size right before using the array itself (clang handles this correctly). Mark this as false positive for now. --- .csmock-kfp.js | 98 ++++++++++++++++++++++++++++++++++++ .github/workflows/csmock.yml | 2 +- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 .csmock-kfp.js diff --git a/.csmock-kfp.js b/.csmock-kfp.js new file mode 100644 index 00000000..162ad7b2 --- /dev/null +++ b/.csmock-kfp.js @@ -0,0 +1,98 @@ +{ + "defects": [ + { + "checker": "COMPILER_WARNING", + "language": "c/c++", + "tool": "gcc", + "key_event_idx": 0, + "events": [ + { + "file_name": "sid-0.0.5/src/resource/ubridge.c", + "line": 735, + "column": 55, + "event": "warning[-Warray-bounds=]", + "message": "array subscript 5 is outside array bounds of 'struct kv_vector_t[5]'", + "verbosity_level": 0 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " 735 | vvalue[VVALUE_IDX_DATA_ALIGNED + idx] = (kv_vector_t) {data, data_size};", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", + "verbosity_level": 1 + }, + { + "file_name": "sid-0.0.5/src/resource/ubridge.c", + "line": 0, + "event": "scope_hint", + "message": "In function '_init_common'", + "verbosity_level": 1 + }, + { + "file_name": "sid-0.0.5/src/resource/ubridge.c", + "line": 5863, + "column": 22, + "event": "note", + "message": "at offset 80 into object 'vvalue' of size 80", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " 5863 | kv_vector_t vvalue[VVALUE_SINGLE_CNT];", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " | ^~~~~~", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " 733| \tif (VVALUE_FLAGS(vvalue) & KV_ALIGN) {", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " 734| \t\tassert(vvalue_size >= (VVALUE_IDX_DATA_ALIGNED + idx));", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " 735|-> \t\tvvalue[VVALUE_IDX_DATA_ALIGNED + idx] = (kv_vector_t) {data, data_size};", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " 736| \t} else {", + "verbosity_level": 1 + }, + { + "file_name": "", + "line": 0, + "event": "#", + "message": " 737| \t\tassert(vvalue_size >= (VVALUE_IDX_DATA + idx));", + "verbosity_level": 1 + } + ] + } + ] +} diff --git a/.github/workflows/csmock.yml b/.github/workflows/csmock.yml index 4e2b2a61..956771b5 100644 --- a/.github/workflows/csmock.yml +++ b/.github/workflows/csmock.yml @@ -54,7 +54,7 @@ jobs: run: podman exec -it ${{ env.CI_CONTAINER }} bash -c "rpmbuild -bs --define '_sourcedir .' rpm/sid.spec" - name: Run csmock - run: podman exec -it ${{ env.CI_CONTAINER }} bash -c "csmock -o sid-csmock-results.tar.xz -r ${{ env.CSMOCK_CHROOTS }} --tools ${{ env.CSMOCK_TOOLS }} ~/rpmbuild/SRPMS/sid*.src.rpm" + run: podman exec -it ${{ env.CI_CONTAINER }} bash -c "csmock --known-false-positives .csmock-kfp.js -o sid-csmock-results.tar.xz -r ${{ env.CSMOCK_CHROOTS }} --tools ${{ env.CSMOCK_TOOLS }} ~/rpmbuild/SRPMS/sid*.src.rpm" - name: Check csmock results run: podman exec -it ${{ env.CI_CONTAINER }} bash -c "tar -xf sid-csmock-results.tar.xz && test -s sid-csmock-results/scan-results-summary.txt && exit 1 || exit 0"