Skip to content

Commit e07e367

Browse files
msg-filters: added filter for too-many event in csdiff
Resolves: issues.redhat.com/browse/OSH-496 Added filter and test for error[too-many] findings in csdiff in order to apply the filter deterministically even if the location and the number of occurrences vary
1 parent be1def4 commit e07e367

8 files changed

+31
-0
lines changed

src/lib/msg-filter.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ MsgFilter::MsgFilter():
7878
d(new Private)
7979
{
8080
d->addMsgFilter("", "[0-9][0-9]* out of [0-9][0-9]* times");
81+
// abstract out the occurrences and rate limit in error[too-many] findings
82+
d->addMsgFilter("", "[0-9]+ (occurrences of warning\\[.*\\] exceeded the specified limit) [0-9]+", "NNNN \\1 NNNN");
8183
d->addMsgFilter("UNUSED_VALUE",
8284
"\\(instance [0-9]+\\)");
8385
d->addMsgFilter("STRING_OVERFLOW",

tests/csdiff/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,6 @@ test_csdiff(diff-misc 22-kernel-zstream-path)
9090
test_csdiff(diff-misc 23-cov-parser-key-event)
9191
test_csdiff(diff-misc 24-shellcheck-line-content)
9292
test_csdiff(diff-misc 25-llvm-17-path-filter)
93+
test_csdiff(diff-misc 26-too-many-events-filter)
9394

9495
add_subdirectory(filter-file)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Error: SNYK_CODE_WARNING (CWE-89):
2+
sqlite-src-3260000/tool/speedtest8.c:219:11: error[cpp/Sqli]: Unsanitized input from a file flows into sqlite3_prepare_v2, where it is used in an SQL query. This may result in an SQL injection vulnerability.
3+
# 217| nStmt++;
4+
# 218| nByte += n;
5+
# 219|-> prepareAndRun(db, &zSql[i], bQuiet);
6+
# 220| }
7+
# 221| zSql[j] = ';';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Error: SNYK_CODE_WARNING (CWE-89):
2+
sqlite-src-3260000/tool/speedtest8.c:219:11: error[cpp/Sqli]: Unsanitized input from a file flows into sqlite3_prepare_v2, where it is used in an SQL query. This may result in an SQL injection vulnerability.
3+
# 217| nStmt++;
4+
# 218| nByte += n;
5+
# 219|-> prepareAndRun(db, &zSql[i], bQuiet);
6+
# 220| }
7+
# 221| zSql[j] = ';';

tests/csdiff/diff-misc/26-too-many-events-filter-fix-z.err

Whitespace-only changes.

tests/csdiff/diff-misc/26-too-many-events-filter-fix.err

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Error: SNYK_CODE_WARNING (CWE-190):
2+
<unknown>: error[too-many]: 1573 occurrences of warning[cpp/IntegerOverflow] exceeded the specified limit 1024
3+
sqlite-src-3260000/tsrc/testfile3.c:1304:5: note: 573 occurrences of warning[cpp/IntegerOverflow] were discarded because of this
4+
5+
Error: SNYK_CODE_WARNING (CWE-89):
6+
sqlite-src-3260000/tool/speedtest8.c:219:11: error[cpp/Sqli]: Unsanitized input from a file flows into sqlite3_prepare_v2, where it is used in an SQL query. This may result in an SQL injection vulnerability.
7+
# 217| nStmt++;
8+
# 218| nByte += n;
9+
# 219|-> prepareAndRun(db, &zSql[i], bQuiet);
10+
# 220| }
11+
# 221| zSql[j] = ';';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Error: SNYK_CODE_WARNING (CWE-190):
2+
<unknown>: error[too-many]: 1573 occurrences of warning[cpp/IntegerOverflow] exceeded the specified limit 1024
3+
sqlite-src-3260000/tsrc/fts3.c:1304:5: note: 573 occurrences of warning[cpp/IntegerOverflow] were discarded because of this

0 commit comments

Comments
 (0)