Skip to content

Commit

Permalink
ci: add .csmock-kfp.js for known csmock false positives
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
prajnoha committed Sep 27, 2023
1 parent 39d25ca commit 86f0ebc
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 1 deletion.
98 changes: 98 additions & 0 deletions .csmock-kfp.js
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/csmock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 86f0ebc

Please sign in to comment.