Skip to content

Commit 5f3f915

Browse files
committed
parser-cov: update explicitly defined key events
... to match the assignment used by Coverity's JSON v7 format Related: https://issues.redhat.com/browse/OSH-552
1 parent 0a0c57e commit 5f3f915

File tree

4 files changed

+51
-53
lines changed

4 files changed

+51
-53
lines changed

src/lib/parser-cov.cc

+15-3
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,18 @@ KeyEventDigger::KeyEventDigger():
233233
d->hMap["BAD_LOCK_OBJECT"] .insert("single_thread_lock");
234234
d->hMap["CALL_SUPER"] .insert("missing_super_call");
235235
d->hMap["CHECKED_RETURN"] .insert("check_return");
236+
d->hMap["CHROOT"] .insert("chroot_call");
236237
d->hMap["CONSTANT_EXPRESSION_RESULT"].insert("extra_high_bits");
237238
d->hMap["CONSTANT_EXPRESSION_RESULT"].insert("logical_vs_bitwise");
238239
d->hMap["CONSTANT_EXPRESSION_RESULT"].insert("missing_parentheses");
239240
d->hMap["CONSTANT_EXPRESSION_RESULT"].insert("operator_confusion");
240241
d->hMap["CONSTANT_EXPRESSION_RESULT"].insert("pointless_expression");
241242
d->hMap["CONSTANT_EXPRESSION_RESULT"].insert("result_independent_of_operands");
242243
d->hMap["CONSTANT_EXPRESSION_RESULT"].insert("same_on_both_sides");
244+
d->hMap["CTOR_DTOR_LEAK"] .insert("alloc_fn");
245+
d->hMap["CTOR_DTOR_LEAK"] .insert("alloc_new");
246+
d->hMap["DEADCODE"] .insert("dead_error_begin");
247+
d->hMap["DEADCODE"] .insert("dead_error_line");
243248
d->hMap["EXPLICIT_THIS_EXPECTED"] .insert("implicit_this_used");
244249
d->hMap["FORWARD_NULL"] .insert("deref_parm");
245250
d->hMap["FORWARD_NULL"] .insert("dereference");
@@ -250,15 +255,22 @@ KeyEventDigger::KeyEventDigger():
250255
d->hMap["LOCK_EVASION"] .insert("thread1_overwrites_value_in_field");
251256
d->hMap["LOCK_EVASION"] .insert("thread2_checks_field_early");
252257
d->hMap["MISSING_BREAK"] .insert("unterminated_case");
253-
d->hMap["NESTING_INDENT_MISMATCH"] .insert("dangling_else");
258+
d->hMap["MISSING_RESTORE"] .insert("end_of_path");
259+
d->hMap["MISSING_RESTORE"] .insert("end_of_scope");
260+
d->hMap["NESTING_INDENT_MISMATCH"] .insert("actual_if");
254261
d->hMap["NESTING_INDENT_MISMATCH"] .insert("multi_stmt_macro");
255262
d->hMap["NESTING_INDENT_MISMATCH"] .insert("on_same_line");
256263
d->hMap["NESTING_INDENT_MISMATCH"] .insert("uncle");
257-
d->hMap["ORDER_REVERSAL"] .insert("lock_acquire");
264+
d->hMap["ORDER_REVERSAL"] .insert("lock_order");
265+
d->hMap["OVERLAPPING_COPY"] .insert("overlapping_assignment");
258266
d->hMap["OVERRUN_STATIC"] .insert("index_parm");
259267
d->hMap["OVERRUN_STATIC"] .insert("overrun-buffer-arg");
260268
d->hMap["OVERRUN_STATIC"] .insert("overrun-local");
261-
d->hMap["STREAM_FORMAT_STATE"] .insert("format_changed");
269+
d->hMap["REVERSE_INULL"] .insert("check_after_deref");
270+
d->hMap["STREAM_FORMAT_STATE"] .insert("end_of_path");
271+
d->hMap["STRING_OVERFLOW"] .insert("fixed_size_dest");
272+
d->hMap["TOCTOU"] .insert("fs_check_call");
273+
d->hMap["UNEXPECTED_CONTROL_FLOW"] .insert("continue_in_do_while_false");
262274
d->hMap["UNINIT"] .insert("uninit_use");
263275
d->hMap["UNINIT"] .insert("uninit_use_in_call");
264276
d->hMap["UNINIT_CTOR"] .insert("uninit_member");

tests/csgrep/0044-csparser-new-key-evts-stdout.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Error: LOCK_INVERSION:
3232
ldapjdk-4.19/java-sdk/ldapjdk/netscape/ldap/LDAPConnThread.java:254:9: getlock: Acquiring lock named "LDAPConnThread.m_sendRequestLock".
3333

3434
Error: NESTING_INDENT_MISMATCH:
35-
qtbase-everywhere-src-5.11.1/qmake/library/qmakeevaluator.cpp:810: dangling_else: The indentation of this "else" clause to column 9 suggests that it was intended to go with the "if" statement indicated by the "intended_if" event, but it actually goes with the "if" indicated by the "actual_if" event because that "if" does not have any other "else" clause.
35+
qtbase-everywhere-src-5.11.1/qmake/library/qmakeevaluator.cpp:810: actual_if: The "else" clause indicated by the "dangling_else" event actually goes with this "if" statement, contrary to what its indentation suggests.
3636

3737
Error: NESTING_INDENT_MISMATCH:
3838
mutt-1.9.3/sort.c:207: multi_stmt_macro: The macro on this line expands into multiple statements, only the first of which is nested within the preceding parent while the rest are not.
@@ -44,7 +44,7 @@ Error: NESTING_INDENT_MISMATCH:
4444
qt-everywhere-opensource-src-4.8.7/tools/qdoc3/doc.cpp:2482: uncle: This statement is indented to column 13, as if it were nested within the preceding parent statement, but it is not.
4545

4646
Error: STREAM_FORMAT_STATE:
47-
nss-3.36.1/nss/cpputil/databuffer.h:92: format_changed: "setfill" changes the format state of "stream" for category fill.
47+
nss-3.36.1/nss/cpputil/databuffer.h:95: format_restored: "dec" changes the format state of "stream" for category basefield.
4848

4949
Error: UNINTENDED_INTEGER_DIVISION:
5050
xfig-3.2.6a/src/e_scale.c:315: integer_division: Dividing integer expressions "fix_y + y" and "2", and then converting the integer quotient to type "double". Any remainder, or fractional part of the quotient, is ignored.

tests/csgrep/0081-sarif-writer-stdout.txt

+18-32
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,6 @@
9393
"text": "https://cwe.mitre.org/data/definitions/561.html"
9494
}
9595
},
96-
{
97-
"id": "DEADCODE: effectively_constant",
98-
"properties": {
99-
"tags": [
100-
"coverity"
101-
],
102-
"cwe": [
103-
"CWE-561"
104-
]
105-
},
106-
"help": {
107-
"text": "https://cwe.mitre.org/data/definitions/561.html"
108-
}
109-
},
11096
{
11197
"id": "FORWARD_NULL: var_deref_model",
11298
"properties": {
@@ -248,7 +234,7 @@
248234
}
249235
},
250236
{
251-
"id": "TOCTOU: toctou",
237+
"id": "TOCTOU: fs_check_call",
252238
"properties": {
253239
"tags": [
254240
"coverity"
@@ -490,13 +476,13 @@
490476
]
491477
},
492478
{
493-
"ruleId": "DEADCODE: effectively_constant",
479+
"ruleId": "DEADCODE: dead_error_line",
494480
"properties": {
495481
"cwe": "CWE-561"
496482
},
497483
"locations": [
498484
{
499-
"id": 4,
485+
"id": 3,
500486
"physicalLocation": {
501487
"artifactLocation": {
502488
"uri": "/builddir/build/BUILD/curl-7.66.0/lib/base64.c"
@@ -508,7 +494,7 @@
508494
}
509495
],
510496
"message": {
511-
"text": "Local variable \"convbuf\" is assigned only once, to a constant value, making it effectively constant throughout its scope. If this is not the intent, examine the logic to see if there is a missing assignment that would make \"convbuf\" not remain constant."
497+
"text": "Execution cannot reach this statement: \"indata = (char *)convbuf;\"."
512498
},
513499
"codeFlows": [
514500
{
@@ -590,7 +576,7 @@
590576
"text": "Execution cannot reach this statement: \"indata = (char *)convbuf;\"."
591577
}
592578
},
593-
"nestingLevel": 1,
579+
"nestingLevel": 0,
594580
"kinds": [
595581
"dead_error_line"
596582
]
@@ -610,7 +596,7 @@
610596
"text": "Local variable \"convbuf\" is assigned only once, to a constant value, making it effectively constant throughout its scope. If this is not the intent, examine the logic to see if there is a missing assignment that would make \"convbuf\" not remain constant."
611597
}
612598
},
613-
"nestingLevel": 0,
599+
"nestingLevel": 1,
614600
"kinds": [
615601
"effectively_constant"
616602
]
@@ -3262,25 +3248,25 @@
32623248
]
32633249
},
32643250
{
3265-
"ruleId": "TOCTOU: toctou",
3251+
"ruleId": "TOCTOU: fs_check_call",
32663252
"properties": {
32673253
"cwe": "CWE-367"
32683254
},
32693255
"locations": [
32703256
{
3271-
"id": 18,
3257+
"id": 10,
32723258
"physicalLocation": {
32733259
"artifactLocation": {
32743260
"uri": "/builddir/build/BUILD/curl-7.66.0/lib/curl_ntlm_wb.c"
32753261
},
32763262
"region": {
3277-
"startLine": 230
3263+
"startLine": 183
32783264
}
32793265
}
32803266
}
32813267
],
32823268
"message": {
3283-
"text": "Calling function \"execl\" that uses \"ntlm_auth\" after a check function. This can cause a time-of-check, time-of-use race condition."
3269+
"text": "Calling function \"access\" to perform check on \"ntlm_auth\"."
32843270
},
32853271
"codeFlows": [
32863272
{
@@ -3502,7 +3488,7 @@
35023488
"text": "Calling function \"access\" to perform check on \"ntlm_auth\"."
35033489
}
35043490
},
3505-
"nestingLevel": 1,
3491+
"nestingLevel": 0,
35063492
"kinds": [
35073493
"fs_check_call"
35083494
]
@@ -3662,7 +3648,7 @@
36623648
"text": "Calling function \"execl\" that uses \"ntlm_auth\" after a check function. This can cause a time-of-check, time-of-use race condition."
36633649
}
36643650
},
3665-
"nestingLevel": 0,
3651+
"nestingLevel": 1,
36663652
"kinds": [
36673653
"toctou"
36683654
]
@@ -3674,25 +3660,25 @@
36743660
]
36753661
},
36763662
{
3677-
"ruleId": "TOCTOU: toctou",
3663+
"ruleId": "TOCTOU: fs_check_call",
36783664
"properties": {
36793665
"cwe": "CWE-367"
36803666
},
36813667
"locations": [
36823668
{
3683-
"id": 19,
3669+
"id": 11,
36843670
"physicalLocation": {
36853671
"artifactLocation": {
36863672
"uri": "/builddir/build/BUILD/curl-7.66.0/lib/curl_ntlm_wb.c"
36873673
},
36883674
"region": {
3689-
"startLine": 223
3675+
"startLine": 183
36903676
}
36913677
}
36923678
}
36933679
],
36943680
"message": {
3695-
"text": "Calling function \"execl\" that uses \"ntlm_auth\" after a check function. This can cause a time-of-check, time-of-use race condition."
3681+
"text": "Calling function \"access\" to perform check on \"ntlm_auth\"."
36963682
},
36973683
"codeFlows": [
36983684
{
@@ -3934,7 +3920,7 @@
39343920
"text": "Calling function \"access\" to perform check on \"ntlm_auth\"."
39353921
}
39363922
},
3937-
"nestingLevel": 1,
3923+
"nestingLevel": 0,
39383924
"kinds": [
39393925
"fs_check_call"
39403926
]
@@ -4094,7 +4080,7 @@
40944080
"text": "Calling function \"execl\" that uses \"ntlm_auth\" after a check function. This can cause a time-of-check, time-of-use race condition."
40954081
}
40964082
},
4097-
"nestingLevel": 0,
4083+
"nestingLevel": 1,
40984084
"kinds": [
40994085
"toctou"
41004086
]

tests/cssort/cssort-5.8/02-by-checker.err

+16-16
Original file line numberDiff line numberDiff line change
@@ -1262,12 +1262,28 @@ Error: STRING_OVERFLOW:
12621262
Error: STRING_OVERFLOW:
12631263
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3169: fixed_size_dest: You might overrun the 512 byte fixed-size string "cp->CCFLAGS" by copying "MMFLAGS" without checking the length.
12641264

1265+
Error: STRING_OVERFLOW:
1266+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3224: fixed_size_dest: You might overrun the 128 byte fixed-size string "znam" by copying "nam" without checking the length.
1267+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3224: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1268+
1269+
Error: STRING_OVERFLOW:
1270+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3238: fixed_size_dest: You might overrun the 128 byte fixed-size string "bnam" by copying "nam" without checking the length.
1271+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3238: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1272+
12651273
Error: STRING_OVERFLOW:
12661274
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3949: fixed_size_dest: You might overrun the 256 byte fixed-size string "cp->CC" by copying "MCC" without checking the length.
12671275

12681276
Error: STRING_OVERFLOW:
12691277
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3951: fixed_size_dest: You might overrun the 512 byte fixed-size string "cp->CCFLAGS" by copying "MMFLAGS" without checking the length.
12701278

1279+
Error: STRING_OVERFLOW:
1280+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/fc.c:477: fixed_size_dest: You might overrun the 80 byte fixed-size string "fnam" by copying "fnam0" without checking the length.
1281+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/fc.c:477: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1282+
1283+
Error: STRING_OVERFLOW:
1284+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/mmsearch.c:472: fixed_size_dest: You might overrun the 128 byte fixed-size string "fnam" by copying "nam" without checking the length.
1285+
/builddir/build/BUILD/ATLAS/tune/blas/gemm/mmsearch.c:472: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1286+
12711287
Error: STRING_OVERFLOW:
12721288
/builddir/build/BUILD/ATLAS/tune/blas/gemv/mvsearch.c:749: fixed_size_dest: You might overrun the 256 byte fixed-size string "Nauth" by copying "authN[Nbest]" without checking the length.
12731289

@@ -1304,22 +1320,6 @@ Error: STRING_OVERFLOW:
13041320
Error: STRING_OVERFLOW:
13051321
/builddir/build/BUILD/ATLAS/tune/blas/gemv/mvsearch.c:760: fixed_size_dest: You might overrun the 512 byte fixed-size string "Sccflags" by copying "ccflagsN[Sbest]" without checking the length.
13061322

1307-
Error: STRING_OVERFLOW:
1308-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3224: fixed_size_dest: You might overrun the 128 byte fixed-size string "znam" by copying "nam" without checking the length.
1309-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3224: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1310-
1311-
Error: STRING_OVERFLOW:
1312-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3238: fixed_size_dest: You might overrun the 128 byte fixed-size string "bnam" by copying "nam" without checking the length.
1313-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/emit_mm.c:3238: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1314-
1315-
Error: STRING_OVERFLOW:
1316-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/fc.c:477: fixed_size_dest: You might overrun the 80 byte fixed-size string "fnam" by copying "fnam0" without checking the length.
1317-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/fc.c:477: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1318-
1319-
Error: STRING_OVERFLOW:
1320-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/mmsearch.c:472: fixed_size_dest: You might overrun the 128 byte fixed-size string "fnam" by copying "nam" without checking the length.
1321-
/builddir/build/BUILD/ATLAS/tune/blas/gemm/mmsearch.c:472: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
1322-
13231323
Error: STRING_SIZE:
13241324
/builddir/build/BUILD/ATLAS/tune/blas/gemm/fc.c:630: var_assign_var: Assigning: "fnam" = "args[1]". Both are now tainted.
13251325
/builddir/build/BUILD/ATLAS/tune/blas/gemm/fc.c:632: string_size: Passing string "fnam" of unknown size to a function that expects a string of a particular size.

0 commit comments

Comments
 (0)