id
stringlengths 8
32
| source_file
stringclasses 51
values | original_function_name
stringlengths 2
66
| anonymized_function_name
stringlengths 2
62
| function_code
stringlengths 15
623
| context
listlengths 0
12
| has_bug
bool 2
classes | bug_types
listlengths 0
3
| bug_line_offsets
listlengths 0
3
| bug_absolute_lines
listlengths 0
3
| bug_severities
listlengths 0
3
| bug_traces
listlengths 0
3
| category
stringclasses 7
values | requires_interprocedural
bool 2
classes | start_line
int32 8
932
| end_line
int32 8
936
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nullptr_more_013
|
pulse/nullptr_more.c
|
safe_allocate
|
safe_allocate
|
int* safe_allocate() {
int* p = NULL;
while (!p) {
p = (int*)malloc(sizeof(int));
}
return p;
}
|
[
"#include <stdlib.h>"
] | true
|
[
"INFINITE_LOOP"
] |
[
2
] |
[
99
] |
[
"WARNING"
] |
[
"in loop"
] |
other
| false
| 97
| 103
|
nullptr_more_014
|
pulse/nullptr_more.c
|
function_call_can_return_null_pointer_bad
|
function_call_can_return_null_pointer
|
void function_call_can_return_null_pointer() {
int* p = NULL;
p = unsafe_allocate();
assign(p, 42); // NULL dereference
free(p);
}
|
[
"#include <stdlib.h>",
"void assign(int* p, int n) { *p = n; }\n",
"int* unsafe_allocate() {\n int* p = NULL;\n p = (int*)malloc(sizeof(int));\n return p;\n}\n"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
108
] |
[
"ERROR"
] |
[
"in call to `unsafe_allocate`,in call to `malloc (null case)` (modelled),is assigned to the null pointer,assigned,returned,return from call to `unsafe_allocate`,assigned,when calling `assign` here,parameter `p` of assign,invalid access occurs here"
] |
nullptr_dereference
| true
| 105
| 110
|
nullptr_more_015
|
pulse/nullptr_more.c
|
function_call_returns_allocated_pointer_ok
|
function_call_returns_allocated_pointer
|
void function_call_returns_allocated_pointer() {
int* p = NULL;
p = safe_allocate();
assign(p, 42);
free(p);
}
|
[
"#include <stdlib.h>",
"void assign(int* p, int n) { *p = n; }\n",
"int* safe_allocate() {\n int* p = NULL;\n while (!p) {\n p = (int*)malloc(sizeof(int));\n }\n return p;\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 112
| 117
|
nullptr_more_016
|
pulse/nullptr_more.c
|
sizeof_expr_ok
|
sizeof_expr
|
void sizeof_expr(void) {
struct Person* p = malloc(sizeof *p);
if (p) {
p->age = 42;
}
free(p);
}
|
[
"#include <stdlib.h>",
"struct Person {\n int age;\n int height;\n int weight;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 119
| 125
|
nullptr_more_017
|
pulse/nullptr_more.c
|
unreachable_null_ok
|
unreachable_null
|
void unreachable_null() {
int* p = NULL;
if (p == NULL) {
will_not_return();
}
*p = 42;
}
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 129
| 135
|
nullptr_more_018
|
pulse/nullptr_more.c
|
no_ret
|
no_ret
|
void no_ret() { will_not_return(); }
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 137
| 137
|
nullptr_more_019
|
pulse/nullptr_more.c
|
unreachable_null_no_return_ok
|
unreachable_null_no_return
|
void unreachable_null_no_return() {
int* p = NULL;
if (p == NULL) {
no_ret(); // inter-procedural call to no_return
}
*p = 42;
}
|
[
"#include <stdlib.h>",
"void no_ret() { will_not_return(); }\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 139
| 145
|
offsetof_expr_001
|
pulse/offsetof_expr.c
|
test_offsetof_expr_bad
|
test_offsetof_expr
|
int test_offsetof_expr() {
int i = offsetof(struct address, v2);
if (i == 2) {
int* p = NULL;
*p = 42;
}
return 42;
}
|
[
"#include <stddef.h>",
"#include <stdlib.h>",
"struct address {\n char v1[2];\n char v2[5];\n int v3;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
4
] |
[
21
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 17
| 24
|
pthread_create_001
|
pulse/pthread_create.c
|
dummy
|
dummy
|
void dummy() {}
|
[
"#include <pthread.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 9
| 9
|
pthread_create_002
|
pulse/pthread_create.c
|
deref_pointer
|
deref_pointer
|
void deref_pointer(int* x) { int y = *x; }
|
[
"#include <pthread.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 11
| 11
|
pthread_create_003
|
pulse/pthread_create.c
|
pthread_create_dummy_ok
|
pthread_create_dummy
|
int pthread_create_dummy() {
pthread_t thread;
return pthread_create(&thread, NULL, dummy, NULL);
}
|
[
"#include <pthread.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 13
| 16
|
pthread_create_004
|
pulse/pthread_create.c
|
pthread_create_deref_ok
|
pthread_create_deref
|
int pthread_create_deref() {
pthread_t thread;
int x;
return pthread_create(&thread, NULL, deref_pointer, &x);
}
|
[
"#include <pthread.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 23
| 27
|
pthread_create_005
|
pulse/pthread_create.c
|
pthread_unknown_ok
|
pthread_unknown
|
int pthread_unknown() {
pthread_t thread;
return pthread_create(&thread, NULL, some_unknown_function, NULL);
}
|
[
"#include <pthread.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 31
| 34
|
pthread_mutex_001
|
pulse/pthread_mutex.c
|
normal_life_ok
|
normal_life
|
int normal_life(pthread_mutex_t* m) {
if (pthread_mutex_init(m, 0))
return 0;
if (pthread_mutex_lock(m))
return 0;
if (pthread_mutex_unlock(m))
return 0;
if (pthread_mutex_destroy(m))
return 0;
return 1;
}
|
[
"#include <pthread.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 9
| 19
|
pthread_mutex_002
|
pulse/pthread_mutex.c
|
normal_ok2
|
normal_ok2
|
int normal_ok2() {
pthread_mutex_t m;
normal_life_ok(&m);
}
|
[
"#include <pthread.h>",
"int normal_life_ok(pthread_mutex_t* m) {\n if (pthread_mutex_init(m, 0))\n return 0;\n if (pthread_mutex_lock(m))\n return 0;\n if (pthread_mutex_unlock(m))\n return 0;\n if (pthread_mutex_destroy(m))\n return 0;\n return 1;\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 21
| 24
|
pthread_mutex_003
|
pulse/pthread_mutex.c
|
double_lock_bad2
|
double_lock_bad2
|
void double_lock_bad2() {
pthread_mutex_t m;
pthread_mutex_init(&m, 0);
FN_double_lock_bad(&m);
}
|
[
"#include <pthread.h>",
"void FN_double_lock_bad(pthread_mutex_t* m) {\n pthread_mutex_lock(m);\n pthread_mutex_lock(m);\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 36
| 40
|
pthread_mutex_004
|
pulse/pthread_mutex.c
|
double_init_ok
|
double_init
|
void double_init() {
pthread_mutex_t m;
double_init_bad(&m);
}
|
[
"#include <pthread.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 60
| 63
|
recursion_001
|
pulse/recursion.c
|
trivial_recursive_bad
|
trivial_recursive
|
void trivial_recursive() { trivial_recursive(); }
|
[
"#include \"recursion2.h\""
] | true
|
[
"INFINITE_RECURSION"
] |
[
0
] |
[
12
] |
[
"WARNING"
] |
[
"`trivial_recursive_bad` makes a recursive call to `trivial_recursive_bad` with the same argument values"
] |
other
| false
| 12
| 12
|
recursion_002
|
pulse/recursion.c
|
factorial_bad
|
factorial
|
int factorial(int x) {
if (x > 0) {
return x * factorial(x - 1);
} else {
return 1;
}
}
|
[
"#include \"recursion2.h\""
] | true
|
[
"MUTUAL_RECURSION_CYCLE"
] |
[
2
] |
[
16
] |
[
"WARNING"
] |
[
"`factorial_bad` makes a recursive call to `factorial_bad`"
] |
other
| false
| 14
| 20
|
recursion_003
|
pulse/recursion.c
|
mutual3_bad
|
mutual3
|
void mutual3() { mutual1_bad(); }
|
[
"#include \"recursion2.h\"",
"void mutual1_bad() { mutual2_bad(); }\n"
] | true
|
[
"INFINITE_RECURSION"
] |
[
0
] |
[
24
] |
[
"WARNING"
] |
[
"`mutual3_bad` calls `mutual1_bad`,`mutual1_bad` calls `mutual2_bad`,`mutual2_bad` makes a recursive call to `mutual3_bad` with the same argument values"
] |
other
| true
| 24
| 24
|
recursion_004
|
pulse/recursion.c
|
mutual2_bad
|
mutual2
|
void mutual2() { mutual3_bad(); }
|
[
"#include \"recursion2.h\"",
"void mutual3_bad() { mutual1_bad(); }\n"
] | true
|
[
"INFINITE_RECURSION"
] |
[
0
] |
[
26
] |
[
"WARNING"
] |
[
"`mutual2_bad` calls `mutual3_bad`,`mutual3_bad` calls `mutual1_bad`,`mutual1_bad` makes a recursive call to `mutual2_bad` with the same argument values"
] |
other
| true
| 26
| 26
|
recursion_005
|
pulse/recursion.c
|
mutual1_bad
|
mutual1
|
void mutual1() { mutual2_bad(); }
|
[
"#include \"recursion2.h\"",
"void mutual2_bad() { mutual3_bad(); }\n"
] | true
|
[
"INFINITE_RECURSION"
] |
[
0
] |
[
28
] |
[
"WARNING"
] |
[
"`mutual1_bad` calls `mutual2_bad`,`mutual2_bad` calls `mutual3_bad`,`mutual3_bad` makes a recursive call to `mutual1_bad` with the same argument values"
] |
other
| true
| 28
| 28
|
recursion_006
|
pulse/recursion.c
|
recursive_modify_global_ok
|
recursive_modify_global
|
void recursive_modify_global(int x) {
if (global > 0) {
global--;
recursive_modify_global(x);
}
}
|
[
"#include \"recursion2.h\""
] | true
|
[
"MUTUAL_RECURSION_CYCLE"
] |
[
3
] |
[
36
] |
[
"WARNING"
] |
[
"`recursive_modify_global_ok` makes a recursive call to `recursive_modify_global_ok`"
] |
other
| false
| 33
| 38
|
recursion_007
|
pulse/recursion.c
|
infinite_recursion_unchanged_global_bad
|
infinite_recursion_unchanged_global
|
void infinite_recursion_unchanged_global(int x) {
if (global > 0) {
global = global;
infinite_recursion_unchanged_global(x);
}
}
|
[
"#include \"recursion2.h\""
] | true
|
[
"INFINITE_RECURSION"
] |
[
3
] |
[
43
] |
[
"WARNING"
] |
[
"`infinite_recursion_unchanged_global_bad` makes a recursive call to `infinite_recursion_unchanged_global_bad` with the same argument values"
] |
other
| false
| 40
| 45
|
recursion_008
|
pulse/recursion.c
|
fp_recursion_on_field_ok
|
fp_recursion_on_field
|
void fp_recursion_on_field(struct data* x) {
if (x->a > 0) {
x->a = x->a - 1;
fp_recursion_on_field(x);
}
}
|
[
"#include \"recursion2.h\"",
"struct data {\n int a;\n int b;\n};"
] | true
|
[
"INFINITE_RECURSION"
] |
[
3
] |
[
57
] |
[
"WARNING"
] |
[
"`fp_recursion_on_field_ok` makes a recursive call to `fp_recursion_on_field_ok` with the same argument values"
] |
other
| false
| 54
| 59
|
recursion_009
|
pulse/recursion.c
|
set_fields
|
set_fields
|
void set_fields(struct data* x, int a, int b) {
x->b = b;
x->a = a;
}
|
[
"#include \"recursion2.h\"",
"struct data {\n int a;\n int b;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 61
| 64
|
recursion_010
|
pulse/recursion.c
|
recursion_on_fields_bad
|
recursion_on_fields
|
void recursion_on_fields(struct data* x) {
// materialize fields of x in the order "a, b" in the pre
int a = x->a;
int b = x->b;
// trick pulse into writing the fields of x in the order "b, a" in the post
set_fields(x, a, b);
recursion_on_fields(x);
}
|
[
"#include \"recursion2.h\"",
"struct data {\n int a;\n int b;\n};",
"void set_fields(struct data* x, int a, int b) {\n x->b = b;\n x->a = a;\n}\n"
] | true
|
[
"INFINITE_RECURSION"
] |
[
6
] |
[
72
] |
[
"WARNING"
] |
[
"`recursion_on_fields_bad` makes a recursive call to `recursion_on_fields_bad` with the same argument values"
] |
other
| true
| 66
| 73
|
recursion_011
|
pulse/recursion.c
|
across_file_1
|
across_file_1
|
void across_file_1() { across_file_2(); }
|
[
"#include \"recursion2.h\""
] | true
|
[
"INFINITE_RECURSION"
] |
[
0
] |
[
77
] |
[
"WARNING"
] |
[
"`across_file_1` calls `across_file_2`,`across_file_2` makes a recursive call to `across_file_1` with the same argument values"
] |
other
| false
| 77
| 77
|
recursion2_001
|
pulse/recursion2.c
|
across_file_2
|
across_file_2
|
void across_file_2() { across_file_1(); }
|
[] | true
|
[
"INFINITE_RECURSION"
] |
[
0
] |
[
10
] |
[
"WARNING"
] |
[
"`across_file_2` calls `across_file_1`,`across_file_1` makes a recursive call to `across_file_2` with the same argument values"
] |
other
| false
| 10
| 10
|
resource_leak_001
|
pulse/resource_leak.c
|
fileNotClosed_bad
|
fileNotClosed
|
void fileNotClosed() {
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
char buffer[256];
write(fd, buffer, strlen(buffer));
}
}
|
[
"#include <errno.h>",
"#include <fcntl.h>",
"#include <stdbool.h>",
"#include <stdint.h>",
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <sys/select.h>",
"#include <sys/socket.h>",
"#include <sys/stat.h>",
"#include <sys/types.h>",
"#include <unistd.h>"
] | true
|
[
"PULSE_RESOURCE_LEAK"
] |
[
4
] |
[
25
] |
[
"ERROR"
] |
[
"allocation part of the trace starts here,allocated by `fopen()` here,file descriptor becomes unreachable here"
] |
resource_leak
| false
| 21
| 27
|
resource_leak_002
|
pulse/resource_leak.c
|
fileClosed_ok
|
fileClosed
|
void fileClosed() {
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
char buffer[256];
write(fd, buffer, strlen(buffer));
close(fd);
}
}
|
[
"#include <errno.h>",
"#include <fcntl.h>",
"#include <stdbool.h>",
"#include <stdint.h>",
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <sys/select.h>",
"#include <sys/socket.h>",
"#include <sys/stat.h>",
"#include <sys/types.h>",
"#include <unistd.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 29
| 36
|
resource_leak_003
|
pulse/resource_leak.c
|
fdopen_to_global_ok
|
fdopen_to_global
|
void fdopen_to_global() {
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
handler = fdopen(fd, "w");
fclose(handler);
}
}
|
[
"#include <errno.h>",
"#include <fcntl.h>",
"#include <stdbool.h>",
"#include <stdint.h>",
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <sys/select.h>",
"#include <sys/socket.h>",
"#include <sys/stat.h>",
"#include <sys/types.h>",
"#include <unistd.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 40
| 46
|
resource_leak_004
|
pulse/resource_leak.c
|
gzdopen_to_global_ok
|
gzdopen_to_global
|
void gzdopen_to_global() {
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
handler = gzdopen(fd, "w");
fclose(handler);
}
}
|
[
"#include <errno.h>",
"#include <fcntl.h>",
"#include <stdbool.h>",
"#include <stdint.h>",
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <sys/select.h>",
"#include <sys/socket.h>",
"#include <sys/stat.h>",
"#include <sys/types.h>",
"#include <unistd.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 48
| 54
|
resource_leak_005
|
pulse/resource_leak.c
|
socketNotClosed_bad
|
socketNotClosed
|
void socketNotClosed() {
int fd = socket(AF_LOCAL, SOCK_RAW, 0);
if (fd != -1) {
char buffer[256];
write(fd, buffer, strlen(buffer));
}
}
|
[
"#include <errno.h>",
"#include <fcntl.h>",
"#include <stdbool.h>",
"#include <stdint.h>",
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <sys/select.h>",
"#include <sys/socket.h>",
"#include <sys/stat.h>",
"#include <sys/types.h>",
"#include <unistd.h>"
] | true
|
[
"PULSE_RESOURCE_LEAK"
] |
[
4
] |
[
60
] |
[
"ERROR"
] |
[
"allocation part of the trace starts here,allocated by `fopen()` here,file descriptor becomes unreachable here"
] |
resource_leak
| false
| 56
| 62
|
resource_leak_006
|
pulse/resource_leak.c
|
socketClosed_ok
|
socketClosed
|
int socketClosed() {
int socketFD = socket(AF_LOCAL, SOCK_RAW, 0);
if (socketFD == -1) {
return -1;
}
int status;
status = fcntl(socketFD, F_SETFL, O_NONBLOCK);
if (status == -1) {
close(socketFD);
return -1;
}
int reuseaddr = 1;
status = setsockopt(
socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr));
if (status == -1) {
close(socketFD);
return -1;
}
int nosigpipe = 1;
status = setsockopt(
socketFD, SOL_SOCKET, SO_REUSEADDR, &nosigpipe, sizeof(nosigpipe));
if (status == -1) {
close(socketFD);
return -1;
}
return socketFD;
}
|
[
"#include <errno.h>",
"#include <fcntl.h>",
"#include <stdbool.h>",
"#include <stdint.h>",
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <sys/select.h>",
"#include <sys/socket.h>",
"#include <sys/stat.h>",
"#include <sys/types.h>",
"#include <unistd.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 64
| 95
|
sentinel_attribute_001
|
pulse/sentinel_attribute.c
|
valid_call_ok
|
valid_call
|
void valid_call(int* a, int* b, int* c) {
// fine
int x = add_all_ints(0, 0, 0, a, b, c, NULL);
}
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 12
| 15
|
shift_001
|
pulse/shift.c
|
return_depends_on_lshift
|
return_depends_on_lshift
|
int* return_depends_on_lshift(int x, int* p) {
if (x < (1 << 7))
return NULL;
else
return p;
}
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 10
| 15
|
shift_002
|
pulse/shift.c
|
return_nonnull_deref1_ok
|
return_nonnull_deref1
|
int return_nonnull_deref1() {
int y = 0;
return *return_depends_on_lshift(1000, &y);
}
|
[
"#include <stdlib.h>",
"int* return_depends_on_lshift(int x, int* p) {\n if (x < (1 << 7))\n return NULL;\n else\n return p;\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 17
| 20
|
shift_003
|
pulse/shift.c
|
return_null_deref1_bad
|
return_null_deref1
|
int return_null_deref1() {
int y = 0;
return *return_depends_on_lshift(0, &y);
}
|
[
"#include <stdlib.h>",
"int* return_depends_on_lshift(int x, int* p) {\n if (x < (1 << 7))\n return NULL;\n else\n return p;\n}\n"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
2
] |
[
24
] |
[
"ERROR"
] |
[
"in call to `return_depends_on_lshift`,is assigned to the null pointer,returned,return from call to `return_depends_on_lshift`,invalid access occurs here"
] |
nullptr_dereference
| true
| 22
| 25
|
shift_004
|
pulse/shift.c
|
return_depends_on_rshift
|
return_depends_on_rshift
|
int* return_depends_on_rshift(int x, int* p) {
if (x < (4 >> 2))
return NULL;
else
return p;
}
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 27
| 32
|
shift_005
|
pulse/shift.c
|
return_nonnull_deref2_ok
|
return_nonnull_deref2
|
int return_nonnull_deref2() {
int y = 0;
return *return_depends_on_rshift(2, &y);
}
|
[
"#include <stdlib.h>",
"int* return_depends_on_rshift(int x, int* p) {\n if (x < (4 >> 2))\n return NULL;\n else\n return p;\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 34
| 37
|
shift_006
|
pulse/shift.c
|
return_null_deref2_bad
|
return_null_deref2
|
int return_null_deref2() {
int y = 0;
return *return_depends_on_rshift(0, &y);
}
|
[
"#include <stdlib.h>",
"int* return_depends_on_rshift(int x, int* p) {\n if (x < (4 >> 2))\n return NULL;\n else\n return p;\n}\n"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
2
] |
[
41
] |
[
"ERROR"
] |
[
"in call to `return_depends_on_rshift`,is assigned to the null pointer,returned,return from call to `return_depends_on_rshift`,invalid access occurs here"
] |
nullptr_dereference
| true
| 39
| 42
|
sizeof_001
|
pulse/sizeof.c
|
sizeof_eval_ok
|
sizeof_eval
|
int sizeof_eval(void) {
int a = 4;
int b = sizeof(a);
char c[2];
if (a % 4) { // 4 % 4 = 0
int* p = NULL;
*p = 42;
}
if (b % sizeof(a)) { // x % x = 0
int* p = NULL;
*p = 42;
}
if (sizeof(c) > 2) { // 2 > 2 is false
int* p = NULL;
*p = 42;
}
if ((sizeof(c) / sizeof(c[0])) != 2) { // (2 / 1) = 2
int* p = NULL;
*p = 42;
}
return 0;
}
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 10
| 32
|
specialization_001
|
pulse/specialization.c
|
id
|
id
|
int id(int i) { return i; }
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 12
| 12
|
specialization_002
|
pulse/specialization.c
|
add_one
|
add_one
|
int add_one(int i) { return invoke(id, i) + 1; }
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 14
| 14
|
specialization_003
|
pulse/specialization.c
|
add_two
|
add_two
|
int add_two(int i) {
int one = invoke(id, 1);
add_one(0);
return invoke(add_one, i) + 1;
}
|
[
"#include <stdlib.h>",
"int add_one(int i) { return invoke(id, i) + 1; }\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 16
| 20
|
specialization_004
|
pulse/specialization.c
|
add_more_bad
|
add_more
|
int add_more(int i) {
if (i > 0) {
return invoke(add_more, i - 1) + 1;
}
return 0;
}
|
[
"#include <stdlib.h>"
] | true
|
[
"MUTUAL_RECURSION_CYCLE"
] |
[
2
] |
[
25
] |
[
"WARNING"
] |
[
"`add_more_bad` calls `invoke`,`invoke` makes a recursive call to `add_more_bad`"
] |
other
| false
| 23
| 28
|
specialization_005
|
pulse/specialization.c
|
test_invoke_ok
|
test_invoke
|
void test_invoke() {
if (add_one(0) != 1) {
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>",
"int add_one(int i) { return invoke(id, i) + 1; }\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 30
| 35
|
specialization_006
|
pulse/specialization.c
|
test_invoke_bad
|
test_invoke
|
void test_invoke() {
if (add_one(0) == 1) {
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>",
"int add_one(int i) { return invoke(id, i) + 1; }\n"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
40
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| true
| 37
| 42
|
specialization_007
|
pulse/specialization.c
|
test_recursive_invoke_ok
|
test_recursive_invoke
|
void test_recursive_invoke() {
if (add_two(0) + add_one(0) != 3) {
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>",
"int add_one(int i) { return invoke(id, i) + 1; }\n",
"int add_two(int i) {\n int one = invoke(id, 1);\n add_one(0);\n return invoke(add_one, i) + 1;\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 44
| 49
|
specialization_008
|
pulse/specialization.c
|
test_recursive_invoke_bad
|
test_recursive_invoke
|
void test_recursive_invoke() {
if (add_two(0) + add_one(0) == 3) {
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>",
"int add_one(int i) { return invoke(id, i) + 1; }\n",
"int add_two(int i) {\n int one = invoke(id, 1);\n add_one(0);\n return invoke(add_one, i) + 1;\n}\n"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
54
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| true
| 51
| 56
|
specialization_009
|
pulse/specialization.c
|
two_pointers_recursion_bad
|
two_pointers_recursion
|
int two_pointers_recursion(int* x, int* y, int i) {
if (i > 0) {
return *x + *y + two_pointers_recursion(x, x, i - 1);
}
return 0;
}
|
[
"#include <stdlib.h>"
] | true
|
[
"MUTUAL_RECURSION_CYCLE"
] |
[
2
] |
[
61
] |
[
"WARNING"
] |
[
"`two_pointers_recursion_bad` makes a recursive call to `two_pointers_recursion_bad`"
] |
other
| false
| 59
| 64
|
specialization_010
|
pulse/specialization.c
|
alias_recursion
|
alias_recursion
|
void alias_recursion(int* z) { two_pointers_recursion_bad(z, z, 10); }
|
[
"#include <stdlib.h>",
"int two_pointers_recursion_bad(int* x, int* y, int i) {\n if (i > 0) {\n return *x + *y + two_pointers_recursion_bad(x, x, i - 1);\n }\n return 0;\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 66
| 66
|
specialization_011
|
pulse/specialization.c
|
specialize_invoke_itself_ok
|
specialize_invoke_itself
|
void specialize_invoke_itself() { invoke_itself_bad(id, 10); }
|
[
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 76
| 76
|
struct_values_001
|
pulse/struct_values.c
|
changes_fields_locally
|
changes_fields_locally
|
void changes_fields_locally(struct s a) {
int u = a.i.x;
a.f = 42;
a.i.y = 15;
}
|
[
"#include <stdlib.h>",
"struct s {\n struct inlined i;\n int f;\n int g;\n};",
"struct inlined {\n int x;\n int y;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 21
| 25
|
struct_values_002
|
pulse/struct_values.c
|
struct_value_in_callee_ok
|
struct_value_in_callee
|
void struct_value_in_callee() {
struct s b = {{11, 22}, 33, 44};
changes_fields_locally(b);
if (b.i.x != 11 || b.i.y != 22 || b.f != 33 || b.g != 44) {
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>",
"struct s {\n struct inlined i;\n int f;\n int g;\n};",
"struct inlined {\n int x;\n int y;\n};",
"void changes_fields_locally(struct s a) {\n int u = a.i.x;\n a.f = 42;\n a.i.y = 15;\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 27
| 34
|
taint_var_arg_001
|
pulse/taint_var_arg.c
|
printf_source_bad1
|
printf_source_bad1
|
void printf_source_bad1() { printf("Integers: %i %u \n", -3456, int_source()); }
|
[
"#include <stdio.h>"
] | true
|
[
"TAINT_ERROR"
] |
[
0
] |
[
13
] |
[
"ERROR"
] |
[
"source of the taint here: value returned from `int_source` with kind `Simple`,flows to this sink: value passed as argument `#2` to `printf` with kind `Simple`"
] |
other
| false
| 13
| 13
|
taint_var_arg_002
|
pulse/taint_var_arg.c
|
printf_source_bad2
|
printf_source_bad2
|
void printf_source_bad2() {
printf("Some different radices: %d %x %o %#x %#o \n",
100,
int_source(),
100,
100,
100);
}
|
[
"#include <stdio.h>"
] | true
|
[
"TAINT_ERROR"
] |
[
1
] |
[
16
] |
[
"ERROR"
] |
[
"source of the taint here: value returned from `int_source` with kind `Simple`,flows to this sink: value passed as argument `#2` to `printf` with kind `Simple`"
] |
other
| false
| 15
| 22
|
taint_var_arg_003
|
pulse/taint_var_arg.c
|
printf_source_bad3
|
printf_source_bad3
|
void printf_source_bad3() {
printf("floats: %4.2f %+.0e %E \n", 3.14159, 3.14159, float_source());
}
|
[
"#include <stdio.h>"
] | true
|
[
"TAINT_ERROR"
] |
[
1
] |
[
25
] |
[
"ERROR"
] |
[
"source of the taint here: value returned from `float_source` with kind `Simple`,flows to this sink: value passed as argument `#3` to `printf` with kind `Simple`"
] |
other
| false
| 24
| 26
|
taint_var_arg_004
|
pulse/taint_var_arg.c
|
printf_source_bad4
|
printf_source_bad4
|
void printf_source_bad4() {
printf("Preceding with zeros: %010d \n", int_source());
}
|
[
"#include <stdio.h>"
] | true
|
[
"TAINT_ERROR"
] |
[
1
] |
[
29
] |
[
"ERROR"
] |
[
"source of the taint here: value returned from `int_source` with kind `Simple`,flows to this sink: value passed as argument `#1` to `printf` with kind `Simple`"
] |
other
| false
| 28
| 30
|
ternary_001
|
pulse/ternary.c
|
ternary1_ok
|
ternary1
|
int ternary1(int x) {
struct data* p = x ? &d : 0;
return (p && p->flag);
}
|
[
"struct data {\n int flag;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 14
| 17
|
ternary_002
|
pulse/ternary.c
|
ternary2_bad
|
ternary2
|
int ternary2(int x) {
struct data* p = x ? &d : 0;
return p->flag && p; // NULL_DEREF
}
|
[
"struct data {\n int flag;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
2
] |
[
21
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 19
| 22
|
ternary_003
|
pulse/ternary.c
|
ternary3_ok
|
ternary3
|
int ternary3(int x) {
struct data* p = x ? &d : 0;
return !(p && p->flag); // OK
}
|
[
"struct data {\n int flag;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 24
| 27
|
ternary_004
|
pulse/ternary.c
|
ternary4_ok
|
ternary4
|
int ternary4(int x) {
struct data* p = x ? &d : 0;
return !(p && p->flag); // OK
}
|
[
"struct data {\n int flag;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 29
| 32
|
ternary_005
|
pulse/ternary.c
|
ternary4_bad
|
ternary4
|
int ternary4(int x) {
struct data* p = x ? &d : 0;
return !(p->flag && p); // NULL_DEREF
}
|
[
"struct data {\n int flag;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
2
] |
[
36
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 34
| 37
|
ternary_006
|
pulse/ternary.c
|
ternary5_ok
|
ternary5
|
int ternary5(int x) {
struct data* p = x ? &d : 0;
return !(p && p->flag); // OK
}
|
[
"struct data {\n int flag;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 39
| 42
|
ternary_007
|
pulse/ternary.c
|
ternary6_ok
|
ternary6
|
int ternary6(int x) {
struct data* p = x ? &d : 0;
return !p || p->flag; // OK
}
|
[
"struct data {\n int flag;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 44
| 47
|
ternary_008
|
pulse/ternary.c
|
ternary7_bad
|
ternary7
|
int ternary7(int x) {
struct data* p = x ? &d : 0;
return p || p->flag; // NULL_DEREF
}
|
[
"struct data {\n int flag;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
2
] |
[
51
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 49
| 52
|
ternary_009
|
pulse/ternary.c
|
ternary8_ok
|
ternary8
|
int ternary8(int x) {
struct data* p = x ? &d : 0;
return (!p || p->flag) && !(p && p->flag); // OK
}
|
[
"struct data {\n int flag;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 54
| 57
|
ternary_010
|
pulse/ternary.c
|
ternary9_ok
|
ternary9
|
int ternary9(int x) {
struct data* p = x ? &d : 0;
return p && (p->flag || !(p->flag)); // OK
}
|
[
"struct data {\n int flag;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 59
| 62
|
traces_001
|
pulse/traces.c
|
simple_deref
|
simple_deref
|
void simple_deref() {
int* p = NULL;
int* q = p; // this line should not be part of the trace
*p = 42;
}
|
[
"#include <stdlib.h>",
"#include <stdint.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
14
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 11
| 15
|
traces_002
|
pulse/traces.c
|
simple_deref_via_alias
|
simple_deref_via_alias
|
void simple_deref_via_alias() {
int* p = NULL;
int* q = p;
*q = 42;
}
|
[
"#include <stdlib.h>",
"#include <stdint.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
20
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 17
| 21
|
traces_003
|
pulse/traces.c
|
call_makes_null_deref_manifest_bad
|
call_makes_null_deref_manifest
|
void call_makes_null_deref_manifest() {
uint16_t utf16String;
uint8_t* utf8String;
size_t utf8StringLen;
something_about_strings_latent(&utf16String, 0, &utf8String, &utf8StringLen);
free(utf8String);
}
|
[
"#include <stdlib.h>",
"#include <stdint.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
4
] |
[
46
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,when calling `something_about_strings_latent` here,in call to `malloc (null case)` (modelled),is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 42
| 48
|
traces_004
|
pulse/traces.c
|
access_null_deref_bad
|
access_null_deref
|
void access_null_deref() {
struct list l = {NULL, 44};
l.next->next = NULL;
}
|
[
"#include <stdlib.h>",
"#include <stdint.h>",
"struct list {\n struct list* next;\n int data;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
2
] |
[
57
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 55
| 58
|
traces_005
|
pulse/traces.c
|
access_use_after_free_bad
|
access_use_after_free
|
void access_use_after_free(struct list* l) {
free(l->next);
l->next->next = NULL;
}
|
[
"#include <stdlib.h>",
"#include <stdint.h>",
"struct list {\n struct list* next;\n int data;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE",
"USE_AFTER_FREE"
] |
[
2,
2
] |
[
62,
62
] |
[
"ERROR",
"ERROR"
] |
[
"*** SUPPRESSED ***,source of the null value part of the trace starts here,assigned,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `l` of access_use_after_free_bad,invalid access occurs here",
"invalidation part of the trace starts here,parameter `l` of access_use_after_free_bad,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,parameter `l` of access_use_after_free_bad,invalid access occurs here"
] |
nullptr_dereference
| false
| 60
| 63
|
transitive-access_001
|
pulse/transitive-access.c
|
sink
|
sink
|
void sink() {}
|
[] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 8
| 8
|
transitive-access_002
|
pulse/transitive-access.c
|
wrapper_ok
|
wrapper
|
void wrapper() { sink(); }
|
[
"void sink() {}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 10
| 10
|
transitive-access_003
|
pulse/transitive-access.c
|
source_bad
|
source
|
void source() { wrapper_ok(); }
|
[
"void wrapper_ok() { sink(); }\n"
] | true
|
[
"PULSE_TRANSITIVE_ACCESS"
] |
[
0
] |
[
12
] |
[
"ERROR"
] |
[
"when calling `wrapper_ok` here,access occurs here"
] |
other
| true
| 12
| 12
|
uninit_001
|
pulse/uninit.c
|
dereference_bad
|
dereference
|
int dereference() {
int* p;
return *p;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
2
] |
[
13
] |
[
"ERROR"
] |
[
"variable `p` declared here,read to uninitialized value occurs here"
] |
uninitialized_value
| false
| 11
| 14
|
uninit_002
|
pulse/uninit.c
|
self_assign_bad
|
self_assign
|
void self_assign() {
int x;
x = x;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
2
] |
[
18
] |
[
"ERROR"
] |
[
"variable `x` declared here,read to uninitialized value occurs here"
] |
uninitialized_value
| false
| 16
| 19
|
uninit_003
|
pulse/uninit.c
|
call_to_use_and_mayinit_bad
|
call_to_use_and_mayinit
|
void call_to_use_and_mayinit() {
int x;
use_and_mayinit(x, &x);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
2
] |
[
25
] |
[
"ERROR"
] |
[
"variable `x` declared here,read to uninitialized value occurs here"
] |
uninitialized_value
| false
| 23
| 26
|
uninit_004
|
pulse/uninit.c
|
malloc_good
|
malloc
|
void malloc() {
int* p = (int*)malloc(sizeof(int));
if (p) {
*p = 5;
int x = *p;
}
free(p);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 28
| 35
|
uninit_005
|
pulse/uninit.c
|
malloc_bad
|
malloc
|
void malloc() {
int* p = (int*)malloc(sizeof(int));
if (p) {
int x = *p;
}
free(p);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
3
] |
[
40
] |
[
"ERROR"
] |
[
"allocated by call to `malloc` (modelled),assigned,read to uninitialized value occurs here"
] |
uninitialized_value
| false
| 37
| 43
|
uninit_006
|
pulse/uninit.c
|
init_int_ref
|
init_int_ref
|
void init_int_ref(int* p) { *p = 5; }
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 45
| 45
|
uninit_007
|
pulse/uninit.c
|
interprocedural_init_in_callee_good
|
interprocedural_init_in_callee
|
void interprocedural_init_in_callee() {
int x;
init_int_ref(&x);
int y = x;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"void init_int_ref(int* p) { *p = 5; }\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 47
| 51
|
uninit_008
|
pulse/uninit.c
|
nop
|
nop
|
void nop(int* p) {}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 53
| 53
|
uninit_009
|
pulse/uninit.c
|
interprocedural_nop_in_callee_bad
|
interprocedural_nop_in_callee
|
void interprocedural_nop_in_callee() {
int x;
nop(&x);
int y = x;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"void nop(int* p) {}\n"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
3
] |
[
58
] |
[
"ERROR"
] |
[
"variable `x` declared here,read to uninitialized value occurs here"
] |
uninitialized_value
| true
| 55
| 59
|
uninit_010
|
pulse/uninit.c
|
read_int_ref
|
read_int_ref
|
void read_int_ref(int* p) { int x = *p; }
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 61
| 61
|
uninit_011
|
pulse/uninit.c
|
interprocedural_read_in_callee_bad
|
interprocedural_read_in_callee
|
void interprocedural_read_in_callee() {
int x;
read_int_ref(&x);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"void read_int_ref(int* p) { int x = *p; }\n"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
2
] |
[
65
] |
[
"ERROR"
] |
[
"variable `x` declared here,when calling `read_int_ref` here,parameter `p` of read_int_ref,read to uninitialized value occurs here"
] |
uninitialized_value
| true
| 63
| 66
|
uninit_012
|
pulse/uninit.c
|
uninit
|
uninit
|
int* uninit() { return (int*)malloc(sizeof(int)); }
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 68
| 68
|
uninit_013
|
pulse/uninit.c
|
interprocedural_uninit_in_callee_bad
|
interprocedural_uninit_in_callee
|
void interprocedural_uninit_in_callee() {
int* p = uninit();
if (p) {
int x = *p;
}
free(p);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"int* uninit() { return (int*)malloc(sizeof(int)); }\n"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
3
] |
[
73
] |
[
"ERROR"
] |
[
"in call to `uninit`,allocated by call to `malloc` (modelled),returned,return from call to `uninit`,assigned,read to uninitialized value occurs here"
] |
uninitialized_value
| true
| 70
| 76
|
uninit_014
|
pulse/uninit.c
|
get_field_address_good
|
get_field_address
|
void get_field_address() {
struct uninit_s* s = (struct uninit_s*)malloc(2 * sizeof(int));
if (s) {
int* p = &s->f1;
}
free(s);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_s {\n int f1;\n int f2;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 83
| 89
|
uninit_015
|
pulse/uninit.c
|
init_f1
|
init_f1
|
void init_f1(struct uninit_s* p) { p->f1 = 5; }
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_s {\n int f1;\n int f2;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 91
| 91
|
uninit_016
|
pulse/uninit.c
|
interprocedural_struct_good
|
interprocedural_struct
|
void interprocedural_struct() {
struct uninit_s s;
init_f1(&s);
int y = s.f1;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_s {\n int f1;\n int f2;\n};",
"void init_f1(struct uninit_s* p) { p->f1 = 5; }\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 93
| 97
|
uninit_017
|
pulse/uninit.c
|
interprocedural_struct_bad
|
interprocedural_struct
|
void interprocedural_struct() {
struct uninit_s s;
init_f1(&s);
int y = s.f2;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_s {\n int f1;\n int f2;\n};",
"void init_f1(struct uninit_s* p) { p->f1 = 5; }\n"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
3
] |
[
102
] |
[
"ERROR"
] |
[
"struct field address `f2` created,read to uninitialized value occurs here"
] |
uninitialized_value
| true
| 99
| 103
|
uninit_018
|
pulse/uninit.c
|
malloc_array_good
|
malloc_array
|
void malloc_array(int len) {
char* o = (char*)malloc(len);
if (o) {
o[0] = 'a';
char c = o[0];
}
free(o);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 105
| 112
|
uninit_019
|
pulse/uninit.c
|
havoc_calling_unknown_struct_good
|
havoc_calling_unknown_struct
|
void havoc_calling_unknown_struct() {
struct uninit_s x = unknown_wrapper();
int y = x.f1;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_s {\n int f1;\n int f2;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 118
| 121
|
uninit_020
|
pulse/uninit.c
|
malloc_array_bad_FN
|
malloc_array_bad_FN
|
void malloc_array_bad_FN(int len) {
char* o = (char*)malloc(len);
if (o) {
o[0] = 'a';
char c = o[1];
}
free(o);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 123
| 130
|
uninit_021
|
pulse/uninit.c
|
local_array_good
|
local_array
|
void local_array() {
char o[10];
o[0] = 'a';
char c = o[0];
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 132
| 136
|
uninit_022
|
pulse/uninit.c
|
local_array_bad_FN
|
local_array_bad_FN
|
void local_array_bad_FN() {
char o[10];
o[0] = 'a';
char c = o[1];
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 138
| 142
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.