Repository navigation
Working through the known cppcheck defects, starting with the suppressions file #7836
Replies: 3 comments 1 reply
|
Following up my own question 1 with the actual measurements, since guessing at this is not much use to anyone. I re-ran cppcheck 2.21.0 over every entry in the Four no longer reproduce at all:
The other two are worse than stale — they are silently inactive: The defect is still there, but the line moved to 515, and suppressions match on line number. Running with That is the argument for the baseline-gated job in question 2, more than any new finding would be: a suppressions file nobody re-runs drifts out of alignment with the code and stops being true, quietly. A baseline keyed on Happy to send the removal of the four dead entries as a small PR, separate from #7835 so they can be reviewed independently — but I would rather have a nod first, given #1313 was closed only in July. One thing I have not checked: cppcheck also reports |
|
I personally do not trust |
|
I read this as: do whatever you want to help you while working with cppcheck; you're probably the only one now. I was open to just merge your suggestion to clear some invalid/resolved exclusions, but personally, it really doesn't merit a PR for it. If you have some useful, reviewable, justified fixes to make, it probably would be a better use of your time. Remember to add your (human) value to the work. |
Uh oh!
There was an error while loading. Please reload this page.
I have started working through the static analysis findings and wanted to flag what I
am doing before going further, so it does not overlap with anyone else.
I opened #7835 today. It fixes a null pointer dereference in
Vect_cat_list_to_array():a
cat_listwith no ranges leaves the array unallocated, and the function then reads itsfirst element. It is reachable through the public API, since
Vect_new_cat_list()returnsa list with no ranges and
Vect_copy_table_by_cat_list()only checks that the list is notNULL, not that it has any. Run the way CI runs pytest, the added test segfaults without
the guard and passes with it.
@wenzeslaus, in #7002 you wrote that when fixing these it is worth "adding tests and/or
focus on places with tests", since the risk is introducing an algorithm bug while fixing
what is often a readability issue. That is what I tried to do here: the change is six
lines, and the test covers both the empty list and the sorting and deduplication that
must not change.
I found it in
.cppcheck-suppressionsunder the "True positives" heading. Going throughthat section, the other three C entries no longer reproduce with cppcheck 2.21:
imagery/i.gensigset/subcluster.c:369— now guarded byif (subsum > 0)imagery/i.smap/model.c:158va_end_missinginlib/gis/debug.c:82—va_startandva_endare pairedSo those look fixed upstream with the suppressions left behind. Two questions:
as it is until each one is re-checked?
noting that cppcheck never got ported into the checks. I have a baseline-gated cppcheck
job working on another C project — it counts findings per
id:fileand fails only onnew ones, so an existing backlog does not block the build — and I would be glad to put
one together here if that is wanted. From that thread I understand leaks in modules are
not treated as bugs, and that the report has to stay quiet to be useful.
Happy to keep going either way. Longer term I am interested in the "Fix Known Code
Defects" idea and would like to work toward GSoC 2027.
All reactions