Clang Project

clang_source_code/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
1{
2  "$schema": "http://json.schemastore.org/sarif-2.0.0-csd.2.beta.2018-11-28",
3  "runs": [
4    {
5      "files": [      
6        {
7          "fileLocation": {
8            "uri": "file:sarif-multi-diagnostic-test.c"
9          },
10          "length": 667,
11          "mimeType": "text/plain",
12          "roles": [
13            "resultFile"
14          ]
15        }
16      ],
17      "resources": {
18        "rules": [
19          {
20            "fullDescription": {
21              "text": "Mark tainted symbols as such."
22            },
23            "id": "debug.TaintTest",
24            "name": {
25              "text": "debug.TaintTest"
26            }
27          },        
28          {
29            "fullDescription": {
30              "text": "Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers)"
31            },
32            "helpUri": "https://clang-analyzer.llvm.org/available_checks.html#core.CallAndMessage",
33            "id": "core.CallAndMessage",
34            "name": {
35              "text": "core.CallAndMessage"
36            }
37          },
38          {
39            "fullDescription": {
40              "text": "Check for division by zero"
41            },
42            "helpUri": "https://clang-analyzer.llvm.org/available_checks.html#core.DivideZero",
43            "id": "core.DivideZero",
44            "name": {
45              "text": "core.DivideZero"
46            }
47          }
48        ]
49      },
50      "results": [
51        {
52          "codeFlows": [
53            {
54              "threadFlows": [
55                {
56                  "locations": [
57                    {
58                      "importance": "essential",
59                      "location": {
60                        "message": {
61                          "text": "Calling 'f'"
62                        },
63                        "physicalLocation": {
64                          "fileLocation": {
65                            "fileIndex": 0,
66                            "uri": "file:sarif-multi-diagnostic-test.c"
67                          },
68                          "region": {
69                            "endColumn": 5,
70                            "endLine": 24,
71                            "startColumn": 3,
72                            "startLine": 24
73                          }
74                        }
75                      }
76                    },
77                    {
78                      "importance": "essential",
79                      "location": {
80                        "message": {
81                          "text": "tainted"
82                        },
83                        "physicalLocation": {
84                          "fileLocation": {
85                            "fileIndex": 0,
86                            "uri": "file:sarif-multi-diagnostic-test.c"
87                          },
88                          "region": {
89                            "endColumn": 17,
90                            "endLine": 9,
91                            "startColumn": 11,
92                            "startLine": 9
93                          }
94                        }
95                      }
96                    }
97                  ]
98                }
99              ]
100            }
101          ],
102          "locations": [
103            {
104              "physicalLocation": {
105                "fileLocation": {
106                  "fileIndex": 0,
107                  "uri": "file:sarif-multi-diagnostic-test.c"
108                },
109                "region": {
110                  "endColumn": 17,
111                  "endLine": 9,
112                  "startColumn": 11,
113                  "startLine": 9
114                }
115              }
116            }
117          ],
118          "message": {
119            "text": "tainted"
120          },
121          "ruleId": "debug.TaintTest",
122          "ruleIndex": 0
123        },
124        {
125          "codeFlows": [
126            {
127              "threadFlows": [
128                {
129                  "locations": [
130                    {
131                      "importance": "essential",
132                      "location": {
133                        "message": {
134                          "text": "Calling 'g'"
135                        },
136                        "physicalLocation": {
137                          "fileLocation": {
138                            "fileIndex": 0,
139                            "uri": "file:sarif-multi-diagnostic-test.c"
140                          },
141                          "region": {
142                            "endColumn": 5,
143                            "endLine": 25,
144                            "startColumn": 3,
145                            "startLine": 25
146                          }
147                        }
148                      }
149                    },
150                    {
151                      "importance": "essential",
152                      "location": {
153                        "message": {
154                          "text": "'fp' declared without an initial value"
155                        },
156                        "physicalLocation": {
157                          "fileLocation": {
158                            "fileIndex": 0,
159                            "uri": "file:sarif-multi-diagnostic-test.c"
160                          },
161                          "region": {
162                            "endColumn": 10,
163                            "endLine": 13,
164                            "startColumn": 3,
165                            "startLine": 13
166                          }
167                        }
168                      }
169                    },
170                    {
171                      "importance": "essential",
172                      "location": {
173                        "message": {
174                          "text": "Called function pointer is an uninitialized pointer value"
175                        },
176                        "physicalLocation": {
177                          "fileLocation": {
178                            "fileIndex": 0,
179                            "uri": "file:sarif-multi-diagnostic-test.c"
180                          },
181                          "region": {
182                            "endColumn": 8,
183                            "endLine": 14,
184                            "startColumn": 3,
185                            "startLine": 14
186                          }
187                        }
188                      }
189                    }
190                  ]
191                }
192              ]
193            }
194          ],
195          "locations": [
196            {
197              "physicalLocation": {
198                "fileLocation": {
199                  "fileIndex": 0,
200                  "uri": "file:sarif-multi-diagnostic-test.c"
201                },
202                "region": {
203                  "endColumn": 8,
204                  "endLine": 14,
205                  "startColumn": 3,
206                  "startLine": 14
207                }
208              }
209            }
210          ],
211          "message": {
212            "text": "Called function pointer is an uninitialized pointer value"
213          },
214          "ruleId": "core.CallAndMessage",
215          "ruleIndex": 1
216        },
217        {
218          "codeFlows": [
219            {
220              "threadFlows": [
221                {
222                  "locations": [
223                    {
224                      "importance": "important",
225                      "location": {
226                        "message": {
227                          "text": "Assuming 'i' is equal to 0"
228                        },
229                        "physicalLocation": {
230                          "fileLocation": {
231                            "fileIndex": 0,
232                            "uri": "file:sarif-multi-diagnostic-test.c"
233                          },
234                          "region": {
235                            "endColumn": 12,
236                            "endLine": 18,
237                            "startColumn": 7,
238                            "startLine": 18
239                          }
240                        }
241                      }
242                    },
243                    {
244                      "importance": "unimportant",
245                      "location": {
246                        "message": {
247                          "text": "Taking true branch"
248                        },
249                        "physicalLocation": {
250                          "fileLocation": {
251                            "fileIndex": 0,
252                            "uri": "file:sarif-multi-diagnostic-test.c"
253                          },
254                          "region": {
255                            "endColumn": 3,
256                            "endLine": 18,
257                            "startColumn": 3,
258                            "startLine": 18
259                          }
260                        }
261                      }
262                    },
263                    {
264                      "importance": "essential",
265                      "location": {
266                        "message": {
267                          "text": "Division by zero"
268                        },
269                        "physicalLocation": {
270                          "fileLocation": {
271                            "fileIndex": 0,
272                            "uri": "file:sarif-multi-diagnostic-test.c"
273                          },
274                          "region": {
275                            "endColumn": 14,
276                            "endLine": 19,
277                            "startColumn": 14,
278                            "startLine": 19
279                          }
280                        }
281                      }
282                    }
283                  ]
284                }
285              ]
286            }
287          ],
288          "locations": [
289            {
290              "physicalLocation": {
291                "fileLocation": {
292                  "fileIndex": 0,
293                  "uri": "file:sarif-multi-diagnostic-test.c"
294                },
295                "region": {
296                  "endColumn": 14,
297                  "endLine": 19,
298                  "startColumn": 14,
299                  "startLine": 19
300                }
301              }
302            }
303          ],
304          "message": {
305            "text": "Division by zero"
306          },
307          "ruleId": "core.DivideZero",
308          "ruleIndex": 2
309        }
310      ],
311      "tool": {
312        "fullName": "clang static analyzer",
313        "language": "en-US",
314        "name": "clang",
315        "version": "clang version 8.0.0 (trunk 345822) (llvm/trunk 345824)"
316      }
317    }
318  ],
319  "version": "2.0.0-csd.2.beta.2018-11-28"
320}
321