@@ -84,9 +84,28 @@ public TestSuiteResults parse(ResultFile resultFile) throws Exception {
8484 static int cweLookup (String checkerKey , String message ) {
8585
8686 switch (checkerKey ) {
87+ // CSharp don't cares
88+ case "CS.LOOP.STR.CONCAT" : //
89+
90+ // C/C++ and Java don't cares
91+ case "CERT.ARR.PTR.ARITH" :
92+ case "CERT.EXPR.PARENS" :
93+ case "CERT.MEM.OBJ_LIFETIME_DTOR" : // Dynamically allocated object pointed to by ''??
8794 case "CWARN.DTOR.NONVIRT.DELETE" : // Obj w/ virtual methods & no virt destruct. deleted
8895 case "CWARN.INCL.NO_INTERFACE" : // File does not include interface header
8996 case "CWARN.NOEFFECT.OUTOFRANGE" : // Expression 'FOO' can never reach the value 'VALUE'
97+ case "CXX.BITOP.BOOL_OPERAND" :
98+ case "CXX.BITOP.NON_CONST_OPERAND" :
99+ case "CXX.CAST.OBJ_PTR_TO_OBJ_PTR" :
100+ case "CXX.ERRNO.NOT_CHECKED" :
101+ case "CXX.ERRNO.NOT_SET" :
102+ case "CXX.ID_VIS.GLOBAL_VARIABLE.EXTERN" : // Extern global variable 'CLASS.VAR' only
103+ // used in 'BAR' has a wide visibility
104+ case "CXX.ID_VIS.GLOBAL_VARIABLE.STATIC" :
105+ case "CXX.LOGICAL_OP.INT_OPERAND" :
106+ case "CXX.POSSIBLE_COPY_PASTE.LOGICAL_OP.CMP_SAME_OBJECT" :
107+ case "CXX.SUSPICIOUS_INDEX_CHECK" :
108+ case "CXX.SUSPICIOUS_INDEX_CHECK.ZERO" :
90109 case "ESCMP.EMPTYSTR" : // Inefficient empty string comparison
91110 case "JD.CAST.DOWNCAST" : // Possible ClassCastException for subtypes
92111 case "JD.METHOD.CBS" : // Method can be declared static
@@ -101,31 +120,14 @@ static int cweLookup(String checkerKey, String message) {
101120 case "SV.IL.SESSION.CLIENT" : // Shouldn't use HttpServletRequest.getRequestedSessionId()
102121 case "SV.LOADLIB.INJ" : // Untrusted call to loadLibrary method
103122 case "SV.SERIAL.NON" : // Class implements Serializable
104- case "SV.SHARED.VAR" : // Unsynchronized access to static variable from servlet
105- case "SV.USAGERULES.PROCESS_VARIANTS" :
106-
107- case "CERT.ARR.PTR.ARITH" :
108- case "CERT.MEM.OBJ_LIFETIME_DTOR" : // Dynamically allocated object pointed to by ''??
109- case "CXX.BITOP.BOOL_OPERAND" :
110- case "CXX.BITOP.NON_CONST_OPERAND" :
111- case "CXX.ERRNO.NOT_CHECKED" :
112- case "CXX.ERRNO.NOT_SET" :
113- case "CERT.EXPR.PARENS" :
114- case "CXX.CAST.OBJ_PTR_TO_OBJ_PTR" :
115- case "CXX.ID_VIS.GLOBAL_VARIABLE.EXTERN" : // Extern global variable 'CLASS.VAR' only
116- // used in 'BAR' has a wide visibility
117- case "CXX.ID_VIS.GLOBAL_VARIABLE.STATIC" :
118- case "CXX.LOGICAL_OP.INT_OPERAND" :
119- case "CXX.POSSIBLE_COPY_PASTE.LOGICAL_OP.CMP_SAME_OBJECT" :
120- case "CXX.SUSPICIOUS_INDEX_CHECK" :
121- case "CXX.SUSPICIOUS_INDEX_CHECK.ZERO" :
122123 case "SV.STR_PAR.UNDESIRED_STRING_PARAMETER" :
123124 case "SV.TAINTED.GLOBAL" : // Unvalidated integer value 'FOO' that is received from
124125 // 'atoi' at line NN is used to assign a global variable at line NN
126+ case "SV.USAGERULES.PROCESS_VARIANTS" :
125127 return CweNumber .DONTCARE ;
126128
127- case "SV.DATA.BOUND " : // Untrusted Data leaks into trusted storage
128- return CweNumber . TRUST_BOUNDARY_VIOLATION ;
129+ case "CS. SV.TAINTED.INJECTION " : // User input can be used to cause arbitrary command
130+ // execution on the host system.
129131 case "SV.EXEC" : // Process Injection
130132 case "SV.EXEC.ENV" : // Process Injection Environment Variables
131133 case "SV.EXEC.LOCAL" : // Process Injection. Local Arguments
@@ -135,6 +137,8 @@ static int cweLookup(String checkerKey, String message) {
135137 return CweNumber .COMMAND_INJECTION ;
136138 case "SV.LDAP" : // Unvalidated user input is used as LDAP filter
137139 return CweNumber .LDAP_INJECTION ;
140+ case "CS.SV.TAINTED.PATH_TRAVERSAL" : // Unvalidated str from extern funct used in file
141+ // path
138142 case "SV.PATH" : // Path and file name injection
139143 case "SV.PATH.INJ" : // File injection
140144 case "SV.TAINTED.PATH_TRAVERSAL" : // Unvalidated str from extern funct used in file path
@@ -143,6 +147,7 @@ static int cweLookup(String checkerKey, String message) {
143147 return CweNumber .WEAK_RANDOM ;
144148 case "SV.SSRF.URI" :
145149 return CweNumber .SSRF ;
150+ case "CS.SQL.INJECT.LOCAL" :
146151 case "SV.SQL" : // SQL Injection
147152 case "SV.SQL.DBSOURCE" : // Unchecked info from DB used in SQL Statement
148153 return CweNumber .SQL_INJECTION ;
@@ -164,6 +169,8 @@ static int cweLookup(String checkerKey, String message) {
164169 case "SV.XXE.XIF" :
165170 case "SV.XXE.XRF" :
166171 return CweNumber .XXE ;
172+ case "SV.DATA.BOUND" : // Untrusted Data leaks into trusted storage
173+ return CweNumber .TRUST_BOUNDARY_VIOLATION ;
167174
168175 case "SV.TAINT_NATIVE" :
169176 return 111 ; // Direct Use of Unsafe JNI
@@ -185,8 +192,13 @@ static int cweLookup(String checkerKey, String message) {
185192 case "SV.TAINTED.CALL.DEREF" : // Unvalidated pointer is dereferenced via a call to FOO
186193 case "SV.TAINTED.DEREF" : // Unvalidated pointer is dereferenced at line FOO
187194 return 123 ; // Write-what-where Condition
195+ case "CS.ABV.EXCEPT" : // IndexOutOfRange exception while accessing array 'array' of size
196+ // 5 using index in range 100..100
188197 case "SV.DOS.ARRINDEX" :
189198 return 129 ; // Improper Validation of Array Index
199+ case "CS.SV.TAINTED.FMTSTR" : // An unvalidated string 'FOO' is received from 'BAR' at
200+ // line NN. It can be used as a format string through a
201+ // call to 'Format' at line NN
190202 case "SV.FMTSTR.GENERIC" :
191203 case "SV.TAINTED.FMTSTR" :
192204 return 134 ; // Use of Externally-Controlled Format String
@@ -236,6 +248,7 @@ static int cweLookup(String checkerKey, String message) {
236248 return 252 ; // Unchecked Return Value
237249 case "SV.PASSWD.PLAIN" : // Plain-text Password
238250 return 256 ; // Plaintext Storage of a Password
251+ case "CS.HCC" : // Use of hardcoded credentials through the call to function 'FOO'
239252 case "HCC" : // Use of hardcoded credentials through the call to function 'FOO'
240253 case "HCC.PWD" : // Use of a hardcoded password through the call to function
241254 // 'CLASS_METHOD'
@@ -267,11 +280,14 @@ static int cweLookup(String checkerKey, String message) {
267280 return 367 ; // TOCTOU Race Condition
268281 case "DBZ.GENERAL" : // Data might be used in division by zero
269282 return 369 ; // Divide by zero
283+ case "CS.NPS" : // No permission set for resource 'FOO' before accessing it
284+ return 377 ; // CWE-377: Insecure Temp File
270285 case "SV.UMC.EXIT" :
271286 case "UMC.EXIT" :
272287 return 382 ; // J2EE: Use of System.exit()
273288 case "SV.UMC.THREADS" :
274289 return 383 ; // J2EE: Direct Use of Threads
290+ case "CS.EMPTY.CATCH" : // Catch clause is empty
275291 case "ECC.EMPTY" : // Empty Exception Block
276292 case "JD.IFEMPTY" :
277293 return 390 ; // Detection of Error Condition w/out Action
@@ -283,12 +299,18 @@ static int cweLookup(String checkerKey, String message) {
283299 case "REDUN.DEF" : // Assignment of variable to itself
284300 case "REDUN.OP" : // Suspicious operation w/ same expression on both sides
285301 return 398 ; // Code quality
302+ case "CS.RESOURCE.LOOP" : // An object of type 'FOO' is allocated in a potentially
303+ // infinite loop that can cause uncontrolled resource
304+ // consumption
305+ return 400 ; // Uncontrolled Resource Consumption
286306 case "CL.MLK" : // Memory leak in class
287307 case "CL.MLK.ASSIGN" : // Possible memory leak in class 'FOO'. Dynamic memory stored in
288308 // 'BAR' can be lost
289309 case "MLK.MIGHT" : // Memory leak
290310 case "MLK.MUST" : // Memory leak
291311 return 401 ; // Missing Release of Memory after Effective Lifetime
312+ case "CS.RLK" : // Object referenced by 'FOO' is lost, but related resources are not
313+ // disposed
292314 case "RH.LEAK" : // Resource acquired may be lost here
293315 return 404 ; // Improper Resource Shutdown or Release
294316 case "CL.FFM.ASSIGN" : // Operator = not defined, causing double freeing of memory
@@ -323,6 +345,17 @@ static int cweLookup(String checkerKey, String message) {
323345 return 468 ; // Incorrect Pointer Scaling
324346 case "SV.TAINT" : // Unvalidated user input passed to security sensitive method
325347 return 470 ; // Unsafe Reflection
348+ case "CS.NRE.FUNC.MIGHT" : // Reference 'FOO' returned from call to function 'BAR' at
349+ // line NN may be null and may be dereferenced at line NN
350+ case "CS.NRE.GEN.CALL.MUST" : // Null reference 'FOO' that comes from line NN will be
351+ // passed to function 'BAR' at line NN and may be
352+ // dereferenced there
353+ case "CS.NRE.GEN.MIGHT" : // Null reference 'array' that comes from line NN may be
354+ // dereferenced at line NN
355+ case "CS.NRE.GEN.MUST" : // Null reference 'FOO' that comes from line NN will be
356+ // dereferenced at line NN
357+ case "CS.RNRE" : // Suspicious dereference of object reference 'FOO' before null check at
358+ // line NN
326359 case "NPD.CHECK.CALL.MUST" : // Pointer 'FOO' checked for NULL at line NN will be passed
327360 // to function and may be dereferenced there by passing
328361 // argument 1 to function 'BAR' at line NN
@@ -390,13 +423,18 @@ static int cweLookup(String checkerKey, String message) {
390423 case "VA_UNUSED.GEN" :
391424 case "VA_UNUSED.INIT" :
392425 return 563 ; // Assignment to Variable without Use
426+ case "SV.SHARED.VAR" : // Unsynchronized access to static variable from servlet
427+ return 567 ; // CWE-567 Unsynchronized Access to Shared Data in a Multithreaded
428+ // Context
393429 case "FIN.EMPTY" :
394430 case "FIN.NOSUPER" :
395431 return 568 ; // finalize() without super.finalize()
396432 case "CWARN.NOEFFECT.UCMP.LT" : // Comparison is always false
397433 case "INVARIANT_CONDITION.UNREACH" : // Condition express always yields same result,
398434 // causing unreachable code
399435 return 570 ; // Expression always false
436+ case "CS.CONSTCOND.IF" : // Condition in 'if' statement is always true or always false
437+ case "CS.CONSTCOND.SWITCH" : // Condition of 'switch' statement is constant
400438 case "CWARN.CONSTCOND.DO" : // Condition of do statement is constant
401439 case "CWARN.CONSTCOND.IF" : // Condition in IF is constant
402440 case "CWARN.CONSTCOND.SWITCH" : // Condition of switch statement is constant
@@ -426,6 +464,10 @@ static int cweLookup(String checkerKey, String message) {
426464 return 590 ; // Free of Memory not on the Heap
427465 case "CMP.STR" :
428466 return 597 ; // Use of Wrong Operator in String Comparison
467+ case "CS.SV.TAINTED.LOOP_BOUND.RESOURCE" : // One or more objects allocated in loop body
468+ // whose exit condition is controlled by an
469+ // unvalidated integer value 'n' at line NN
470+ // (DRW TODO: Move under 253?)
429471 case "SV.TAINTED.CALL.LOOP_BOUND" : // Unvalidated value is used in loop condition thru
430472 // call
431473 case "SV.TAINTED.LOOP_BOUND" : // Unvalidated value is used in loop condition
@@ -443,6 +485,7 @@ static int cweLookup(String checkerKey, String message) {
443485 return 675 ; // Multiple Ops on Rsrc in Single-Operation Context
444486 case "SV.UNBOUND_STRING_INPUT.CIN" : // Avoid using cin, as its prone to buffer overruns
445487 return 676 ; // Use of Potentially Dangerous Function
488+ case "CS.SV.TAINTED.ALLOC_SIZE" : // Unvalidated int can be be used to alter memory alloc
446489 case "SV.TAINTED.ALLOC_SIZE" : // Unvalidated int can be be used to alter memory alloc
447490 return 680 ; // Integer Overflow to Buffer Overflow
448491 case "PORTING.BYTEORDER.SIZE" : // Incompatible type used with network macro
@@ -473,6 +516,9 @@ static int cweLookup(String checkerKey, String message) {
473516 case "SV.FMT_STR.SCAN_FORMAT_MISMATCH.UNDESIRED" : // swscanf format specification '%99S'
474517 // expects type 'char *' for 'S', but parameter 3 has a different type 'wchar_t*'
475518 return 688 ; // Call w/ Incorrect Var or Ref as Argument
519+ case "CS.NRE.FUNC.CALL.MUST" : // Pointer ret from call may be null and passed to func
520+ case "CS.NRE.FUNC.MUST" : // Reference 'FOO.BAR()' returned from call to function 'BAR'
521+ // at line NN may be null and will be dereferenced at line NN
476522 case "NPD.CHECK.MUST" : // Pointer checked for null will be dereferenced
477523 // case "NPD.FUNC.MIGHT": // Pointer ret from call may be null and be dereferenced
478524 case "NPD.FUNC.CALL.MUST" : // Pointer ret from call may be null and passed to func
0 commit comments