CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
// RUN: rm -rf %t && mkdir %t && %clang_analyze_cc1 -analyzer-checker=core,optin.taint,debug.TaintTest,unix.Malloc %s -verify -analyzer-output=sarif-html -o %t%{fs-sep}out.sarif
|
|
// RUN: cat %t%{fs-sep}out.sarif | %normalize_sarif | diff -U1 -b %S/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif -
|
|
#include "../Inputs/system-header-simulator.h"
|
|
#include "../Inputs/system-header-simulator-for-malloc.h"
|
|
#define ERR -1
|
|
int atoi(const char *nptr);
|
|
|
|
void f(void) {
|
|
char s[80];
|
|
scanf("%s", s);
|
|
int d = atoi(s); // expected-warning {{tainted}}
|
|
}
|
|
|
|
void g(void) {
|
|
void (*fp)(int);
|
|
fp(12); // expected-warning {{Called function pointer is an uninitialized pointer value}}
|
|
}
|
|
|
|
int h(int i) {
|
|
if (i == 0)
|
|
return 1 / i; // expected-warning {{Division by zero}}
|
|
return 0;
|
|
}
|
|
|
|
int leak(int i) {
|
|
void *mem = malloc(8);
|
|
if (i < 4)
|
|
return ERR; // expected-warning {{Potential leak of memory pointed to by 'mem'}}
|
|
free(mem);
|
|
return 0;
|
|
}
|
|
|
|
int unicode(void) {
|
|
int løçål = 0;
|
|
/* ☃ */ return 1 / løçål; // expected-warning {{Division by zero}}
|
|
}
|
|
|
|
int main(void) {
|
|
f();
|
|
g();
|
|
h(0);
|
|
leak(0);
|
|
unicode();
|
|
return 0;
|
|
}
|