Skip to content

Commit 3c764eb

Browse files
jperezdealgabakdudka
authored andcommitted
msg-filter: abstract out numbers from error[too-many] findings
Abstract out the number of occurrences and configured rate limit in `error[too-many]` findings. Resolves: https://issues.redhat.com/browse/OSH-496 Closes: #188
1 parent be1def4 commit 3c764eb

8 files changed

+42
-0
lines changed

src/lib/msg-filter.cc

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ MsgFilter::MsgFilter():
7878
d(new Private)
7979
{
8080
d->addMsgFilter("", "[0-9][0-9]* out of [0-9][0-9]* times");
81+
82+
// abstract out the number of occurrences and rate limit in error[too-many] findings
83+
d->addMsgFilter("", "^[0-9]+ (occurrences of warning\\[.*\\] exceeded the specified limit) [0-9]+$",
84+
"NNNN \\1 NNNN");
85+
8186
d->addMsgFilter("UNUSED_VALUE",
8287
"\\(instance [0-9]+\\)");
8388
d->addMsgFilter("STRING_OVERFLOW",

tests/csdiff/CMakeLists.txt

+1
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)
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] = ';';
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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-190):
6+
<unknown>: error[memleak]: 1573 occurrences of warning[cpp/memleak] exceeded the specified limit 1024
7+
sqlite-src-3260000/tsrc/testfile3.c:1304:5: note: 573 occurrences of warning[cpp/IntegerOverflow] were discarded because of this
8+
9+
Error: SNYK_CODE_WARNING (CWE-89):
10+
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.
11+
# 217| nStmt++;
12+
# 218| nByte += n;
13+
# 219|-> prepareAndRun(db, &zSql[i], bQuiet);
14+
# 220| }
15+
# 221| zSql[j] = ';';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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
4+
5+
Error: SNYK_CODE_WARNING (CWE-190):
6+
<unknown>: error[memleak]: 15173 occurrences of warning[cpp/memleak] exceeded the specified limit 102123
7+
sqlite-src-3260000/tsrc/testfile3.c:1304:5: note: 573 occurrences of warning[cpp/IntegerOverflow] were discarded because of this

0 commit comments

Comments
 (0)