-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
229 additions
and
10 deletions.
There are no files selected for viewing
230 changes: 229 additions & 1 deletion
230
tools/report-converter/tests/unit/analyzers/gcc_output_test_files/out/double_free.cpp.sarif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,229 @@ | ||
{"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", "version": "2.1.0", "runs": [{"tool": {"driver": {"name": "GNU C++17", "fullName": "GNU C++17 (Ubuntu 13.1.0-8ubuntu1~22.04) version 13.1.0 (x86_64-linux-gnu)", "version": "13.1.0", "informationUri": "https://gcc.gnu.org/gcc-13/", "rules": [{"id": "-Wanalyzer-double-free", "helpUri": "https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-free"}]}}, "taxonomies": [{"name": "CWE", "version": "4.7", "organization": "MITRE", "shortDescription": {"text": "The MITRE Common Weakness Enumeration"}, "taxa": [{"id": "415", "helpUri": "https://cwe.mitre.org/data/definitions/415.html"}]}], "invocations": [{"executionSuccessful": true, "toolExecutionNotifications": []}], "originalUriBaseIds": {"PWD": {"uri": "file:///home/eumakri/Documents/codechecker/tools/report-converter/tests/unit/analyzers/gcc_output_test_files/out/"}}, "artifacts": [{"location": {"uri": "../files/double_free.cpp", "uriBaseId": "PWD"}, "contents": {"text": "// -------------------------------------------------------------------------\n// Part of the CodeChecker project, under the Apache License v2.0 with\n// LLVM Exceptions. See LICENSE for license information.\n// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n// -------------------------------------------------------------------------\n\n#include <stdlib.h>\n\nvoid test() {\n void *ptr = malloc(sizeof(int));\n free(ptr);\n free(ptr);\n}\n"}, "sourceLanguage": "cplusplus"}], "results": [{"ruleId": "-Wanalyzer-double-free", "taxa": [{"id": "415", "toolComponent": {"name": "cwe"}}], "level": "warning", "message": {"text": "double-‘free’ of ‘ptr’"}, "locations": [{"physicalLocation": {"artifactLocation": {"uri": "../files/double_free.cpp", "uriBaseId": "PWD"}, "region": {"startLine": 12, "startColumn": 3, "endColumn": 12}, "contextRegion": {"startLine": 12, "snippet": {"text": " free(ptr);\n"}}}, "logicalLocations": [{"name": "test", "fullyQualifiedName": "test", "decoratedName": "_Z4testv", "kind": "function"}]}], "codeFlows": [{"threadFlows": [{"locations": [{"location": {"physicalLocation": {"artifactLocation": {"uri": "../files/double_free.cpp", "uriBaseId": "PWD"}, "region": {"startLine": 10, "startColumn": 15, "endColumn": 34}, "contextRegion": {"startLine": 10, "snippet": {"text": " void *ptr = malloc(sizeof(int));\n"}}}, "logicalLocations": [{"name": "test", "fullyQualifiedName": "test", "decoratedName": "_Z4testv", "kind": "function"}], "message": {"text": "allocated here"}}, "kinds": ["acquire", "memory"], "nestingLevel": 1}, {"location": {"physicalLocation": {"artifactLocation": {"uri": "../files/double_free.cpp", "uriBaseId": "PWD"}, "region": {"startLine": 11, "startColumn": 3, "endColumn": 12}, "contextRegion": {"startLine": 11, "snippet": {"text": " free(ptr);\n"}}}, "logicalLocations": [{"name": "test", "fullyQualifiedName": "test", "decoratedName": "_Z4testv", "kind": "function"}], "message": {"text": "first ‘free’ here"}}, "kinds": ["release", "memory"], "nestingLevel": 1}, {"location": {"physicalLocation": {"artifactLocation": {"uri": "../files/double_free.cpp", "uriBaseId": "PWD"}, "region": {"startLine": 12, "startColumn": 3, "endColumn": 12}, "contextRegion": {"startLine": 12, "snippet": {"text": " free(ptr);\n"}}}, "logicalLocations": [{"name": "test", "fullyQualifiedName": "test", "decoratedName": "_Z4testv", "kind": "function"}], "message": {"text": "second ‘free’ here; first ‘free’ was at (2)"}}, "kinds": ["danger"], "nestingLevel": 1}]}]}]}]}]} | ||
{ | ||
"$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", | ||
"version":"2.1.0", | ||
"runs":[ | ||
{ | ||
"tool":{ | ||
"driver":{ | ||
"name":"GNU C++17", | ||
"fullName":"GNU C++17 (Ubuntu 13.1.0-8ubuntu1~22.04) version 13.1.0 (x86_64-linux-gnu)", | ||
"version":"13.1.0", | ||
"informationUri":"https://gcc.gnu.org/gcc-13/", | ||
"rules":[ | ||
{ | ||
"id":"-Wanalyzer-double-free", | ||
"helpUri":"https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-free" | ||
} | ||
] | ||
} | ||
}, | ||
"taxonomies":[ | ||
{ | ||
"name":"CWE", | ||
"version":"4.7", | ||
"organization":"MITRE", | ||
"shortDescription":{ | ||
"text":"The MITRE Common Weakness Enumeration" | ||
}, | ||
"taxa":[ | ||
{ | ||
"id":"415", | ||
"helpUri":"https://cwe.mitre.org/data/definitions/415.html" | ||
} | ||
] | ||
} | ||
], | ||
"invocations":[ | ||
{ | ||
"executionSuccessful":true, | ||
"toolExecutionNotifications":[ | ||
|
||
] | ||
} | ||
], | ||
"originalUriBaseIds":{ | ||
"PWD":{ | ||
"uri":"tests/unit/analyzers/gcc_output_test_files/out/" | ||
} | ||
}, | ||
"artifacts":[ | ||
{ | ||
"location":{ | ||
"uri":"../files/double_free.cpp", | ||
"uriBaseId":"PWD" | ||
}, | ||
"contents":{ | ||
"text":"// -------------------------------------------------------------------------\n// Part of the CodeChecker project, under the Apache License v2.0 with\n// LLVM Exceptions. See LICENSE for license information.\n// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n// -------------------------------------------------------------------------\n\n#include <stdlib.h>\n\nvoid test() {\n void *ptr = malloc(sizeof(int));\n free(ptr);\n free(ptr);\n}\n" | ||
}, | ||
"sourceLanguage":"cplusplus" | ||
} | ||
], | ||
"results":[ | ||
{ | ||
"ruleId":"-Wanalyzer-double-free", | ||
"taxa":[ | ||
{ | ||
"id":"415", | ||
"toolComponent":{ | ||
"name":"cwe" | ||
} | ||
} | ||
], | ||
"level":"warning", | ||
"message":{ | ||
"text":"double-‘free’ of ‘ptr’" | ||
}, | ||
"locations":[ | ||
{ | ||
"physicalLocation":{ | ||
"artifactLocation":{ | ||
"uri":"../files/double_free.cpp", | ||
"uriBaseId":"PWD" | ||
}, | ||
"region":{ | ||
"startLine":12, | ||
"startColumn":3, | ||
"endColumn":12 | ||
}, | ||
"contextRegion":{ | ||
"startLine":12, | ||
"snippet":{ | ||
"text":" free(ptr);\n" | ||
} | ||
} | ||
}, | ||
"logicalLocations":[ | ||
{ | ||
"name":"test", | ||
"fullyQualifiedName":"test", | ||
"decoratedName":"_Z4testv", | ||
"kind":"function" | ||
} | ||
] | ||
} | ||
], | ||
"codeFlows":[ | ||
{ | ||
"threadFlows":[ | ||
{ | ||
"locations":[ | ||
{ | ||
"location":{ | ||
"physicalLocation":{ | ||
"artifactLocation":{ | ||
"uri":"../files/double_free.cpp", | ||
"uriBaseId":"PWD" | ||
}, | ||
"region":{ | ||
"startLine":10, | ||
"startColumn":15, | ||
"endColumn":34 | ||
}, | ||
"contextRegion":{ | ||
"startLine":10, | ||
"snippet":{ | ||
"text":" void *ptr = malloc(sizeof(int));\n" | ||
} | ||
} | ||
}, | ||
"logicalLocations":[ | ||
{ | ||
"name":"test", | ||
"fullyQualifiedName":"test", | ||
"decoratedName":"_Z4testv", | ||
"kind":"function" | ||
} | ||
], | ||
"message":{ | ||
"text":"allocated here" | ||
} | ||
}, | ||
"kinds":[ | ||
"acquire", | ||
"memory" | ||
], | ||
"nestingLevel":1 | ||
}, | ||
{ | ||
"location":{ | ||
"physicalLocation":{ | ||
"artifactLocation":{ | ||
"uri":"../files/double_free.cpp", | ||
"uriBaseId":"PWD" | ||
}, | ||
"region":{ | ||
"startLine":11, | ||
"startColumn":3, | ||
"endColumn":12 | ||
}, | ||
"contextRegion":{ | ||
"startLine":11, | ||
"snippet":{ | ||
"text":" free(ptr);\n" | ||
} | ||
} | ||
}, | ||
"logicalLocations":[ | ||
{ | ||
"name":"test", | ||
"fullyQualifiedName":"test", | ||
"decoratedName":"_Z4testv", | ||
"kind":"function" | ||
} | ||
], | ||
"message":{ | ||
"text":"first ‘free’ here" | ||
} | ||
}, | ||
"kinds":[ | ||
"release", | ||
"memory" | ||
], | ||
"nestingLevel":1 | ||
}, | ||
{ | ||
"location":{ | ||
"physicalLocation":{ | ||
"artifactLocation":{ | ||
"uri":"../files/double_free.cpp", | ||
"uriBaseId":"PWD" | ||
}, | ||
"region":{ | ||
"startLine":12, | ||
"startColumn":3, | ||
"endColumn":12 | ||
}, | ||
"contextRegion":{ | ||
"startLine":12, | ||
"snippet":{ | ||
"text":" free(ptr);\n" | ||
} | ||
} | ||
}, | ||
"logicalLocations":[ | ||
{ | ||
"name":"test", | ||
"fullyQualifiedName":"test", | ||
"decoratedName":"_Z4testv", | ||
"kind":"function" | ||
} | ||
], | ||
"message":{ | ||
"text":"second ‘free’ here; first ‘free’ was at (2)" | ||
} | ||
}, | ||
"kinds":[ | ||
"danger" | ||
], | ||
"nestingLevel":1 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters