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
abduce_001
pulse/abduce.c
const_local_no_abduce
const_local_no_abduce
int const_local_no_abduce(int* p) { external_func(&p); return p ? *p : 0; // We shouldn't get a stack address escape warning here }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
12
16
abduce_002
pulse/abduce.c
set_ptr
set_ptr
void set_ptr(int* ptr, int val) { *ptr = val; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
18
18
abduce_003
pulse/abduce.c
set_ptr_local_array
set_ptr_local_array
int set_ptr_local_array() { int buf[2]; set_ptr(buf, 1); return buf[0]; }
[ "#include <stdlib.h>", "void set_ptr(int* ptr, int val) { *ptr = val; }\n" ]
false
[]
[]
[]
[]
[]
safe
true
20
24
abduce_004
pulse/abduce.c
set_ptr_param_array
set_ptr_param_array
int set_ptr_param_array(int buf[]) { set_ptr(buf, 1); return buf[0]; }
[ "#include <stdlib.h>", "void set_ptr(int* ptr, int val) { *ptr = val; }\n" ]
false
[]
[]
[]
[]
[]
safe
true
33
36
abduce_005
pulse/abduce.c
set_ptr_param_array_get_null_bad
set_ptr_param_array_get_null
void set_ptr_param_array_get_null() { // A null pointer dereference is expected here set_ptr_param_array(NULL); }
[ "#include <stdlib.h>", "int set_ptr_param_array(int buf[]) {\n set_ptr(buf, 1);\n return buf[0];\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 2 ]
[ 56 ]
[ "ERROR" ]
[ "is assigned to the null pointer,when calling `set_ptr_param_array` here,parameter `buf` of set_ptr_param_array,when calling `set_ptr` here,parameter `ptr` of set_ptr,invalid access occurs here" ]
nullptr_dereference
true
54
57
aliasing_001
pulse/aliasing.c
local_addr_noalias_bad
local_addr_noalias
void local_addr_noalias(int* p) { int* q = NULL; int x = 1; if (&x != p) { *q = 42; } }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 22 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
18
24
aliasing_002
pulse/aliasing.c
global_addr_alias_bad
global_addr_alias
void global_addr_alias(int* p) { int* q = NULL; if (&g == p) { *q = 42; } }
[ "#include <stdlib.h>", "static int g = 0;" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 30 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
27
32
angelism_001
pulse/angelism.c
by_ref_actual_already_in_footprint
by_ref_actual_already_in_footprint
void by_ref_actual_already_in_footprint(struct delicious* param) { int i; struct delicious* ret = bakery(&param); i = param->yum; }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
51
55
angelism_002
pulse/angelism.c
call_by_ref_actual_already_in_footprint_ok
call_by_ref_actual_already_in_footprint
void call_by_ref_actual_already_in_footprint() { by_ref_actual_already_in_footprint(NULL); // should not report a warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};", "void by_ref_actual_already_in_footprint(struct delicious* param) {\n int i;\n struct delicious* ret = bakery(&param);\n i = param->yum;\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
57
59
angelism_003
pulse/angelism.c
by_ref_actual_already_in_footprint2
by_ref_actual_already_in_footprint2
void by_ref_actual_already_in_footprint2(struct delicious* param) { int i; i = param->yum; // should not report a warning struct delicious* ret = bakery(&param); i = param->yum; // should not report a warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
61
66
angelism_004
pulse/angelism.c
call_by_ref_actual_already_in_footprint_bad
call_by_ref_actual_already_in_footprint
void call_by_ref_actual_already_in_footprint() { by_ref_actual_already_in_footprint2(NULL); // should report a warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};", "void by_ref_actual_already_in_footprint2(struct delicious* param) {\n int i;\n i = param->yum; // should not report a warning\n struct delicious* ret = bakery(&param);\n i = param->yum; // should not report a warning\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 1 ]
[ 69 ]
[ "ERROR" ]
[ "is assigned to the null pointer,when calling `by_ref_actual_already_in_footprint2` here,parameter `param` of by_ref_actual_already_in_footprint2,invalid access occurs here" ]
nullptr_dereference
true
68
70
angelism_005
pulse/angelism.c
passByRefTwiceOk
passByRefTwiceOk
void passByRefTwiceOk() { struct delicious* param; bakery2(&param, &param); // should not report a warning int i = param->yum; }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
72
76
angelism_006
pulse/angelism.c
returnPassByRefDerefOk
returnPassByRefDerefOk
void returnPassByRefDerefOk() { struct delicious* ret = returnPassByRef(); ret->yum = 2; // should not report a warning free(ret); }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
85
89
angelism_007
pulse/angelism.c
struct_value_by_ref_ptr_ok
struct_value_by_ref_ptr
int struct_value_by_ref_ptr() { struct delicious x; struct_ptr_skip(&x); return *x.ptr; // should not report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
95
99
angelism_008
pulse/angelism.c
struct_value_by_ref_ptr_write_before_ok
struct_value_by_ref_ptr_write_before
int struct_value_by_ref_ptr_write_before() { struct delicious x; x.ptr = NULL; struct_ptr_skip(&x); return *x.ptr; // should not report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
101
106
angelism_009
pulse/angelism.c
struct_value_by_ref_ptr_write_bad
struct_value_by_ref_ptr_write
int struct_value_by_ref_ptr_write() { struct delicious x; struct_ptr_skip(&x); x.ptr = NULL; return *x.ptr; // should report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 112 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
108
113
angelism_010
pulse/angelism.c
setF
setF
void setF(struct delicious* x, int val) { x->ptr = val; }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
115
115
angelism_011
pulse/angelism.c
struct_value_by_ref_callee_write_no_skip_bad
struct_value_by_ref_callee_write_no_skip
int struct_value_by_ref_callee_write_no_skip() { struct delicious x; setF(&x, NULL); return *x.ptr; // should report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};", "void setF(struct delicious* x, int val) { x->ptr = val; }\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 120 ]
[ "ERROR" ]
[ "is assigned to the null pointer,in call to `setF`,parameter `val` of setF,assigned,return from call to `setF`,invalid access occurs here" ]
nullptr_dereference
true
117
121
angelism_012
pulse/angelism.c
struct_value_by_ref_callee_write_skip_bad
struct_value_by_ref_callee_write_skip
int struct_value_by_ref_callee_write_skip() { struct delicious x; struct_ptr_skip(&x); setF(&x, NULL); return *x.ptr; // should report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};", "void setF(struct delicious* x, int val) { x->ptr = val; }\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 127 ]
[ "ERROR" ]
[ "is assigned to the null pointer,in call to `setF`,parameter `val` of setF,assigned,return from call to `setF`,invalid access occurs here" ]
nullptr_dereference
true
123
128
angelism_013
pulse/angelism.c
struct_value_by_ref_write_then_skip_ok
struct_value_by_ref_write_then_skip
int struct_value_by_ref_write_then_skip() { struct delicious x; x.ptr = NULL; struct_ptr_skip(&x); return *x.ptr; // should not report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
130
135
angelism_014
pulse/angelism.c
struct_value_skip_null_deref_bad
struct_value_skip_null_deref
int struct_value_skip_null_deref() { struct delicious x; x.ptr = NULL; struct_val_skip(x); return *x.ptr; // should report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 141 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
137
142
angelism_015
pulse/angelism.c
struct_value_skip_ok
struct_value_skip
int struct_value_skip() { struct delicious x; x.yum = 7; struct_val_skip(x); return 1 / x.yum; // should not report div by zero warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
144
149
angelism_016
pulse/angelism.c
struct_value_from_pointer_skip_ok
struct_value_from_pointer_skip
int struct_value_from_pointer_skip(struct delicious* x) { struct_val_skip(*x); return 1 / x->yum; // should not report div by zero warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
151
154
angelism_017
pulse/angelism.c
struct_value_from_pointer_skip_bad
struct_value_from_pointer_skip
int struct_value_from_pointer_skip(struct delicious* x) { x->ptr = NULL; struct_val_skip(*x); return 1 / *x->ptr; // should report null deref warning }
[ "#include <stdlib.h>", "struct delicious {\n int yum;\n int* ptr;\n};" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 159 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
156
160
arithmetic_001
pulse/arithmetic.c
return_non_negative
return_non_negative
int return_non_negative() { int x = random(); if (x < 0) { exit(1); } return x; }
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
11
17
arithmetic_002
pulse/arithmetic.c
return_non_negative_is_non_negative_ok
return_non_negative_is_non_negative
void return_non_negative_is_non_negative() { if (return_non_negative() < 0) { int* p = NULL; *p = 42; } }
[ "#include <assert.h>", "#include <stdlib.h>", "int return_non_negative() {\n int x = random();\n if (x < 0) {\n exit(1);\n }\n return x;\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
19
24
arithmetic_003
pulse/arithmetic.c
assume_non_negative
assume_non_negative
void assume_non_negative(int x) { if (x < 0) { exit(1); } }
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
26
30
arithmetic_004
pulse/arithmetic.c
assume_non_negative_is_non_negative_ok
assume_non_negative_is_non_negative
void assume_non_negative_is_non_negative() { int x = random(); assume_non_negative(x); if (x < 0) { int* p = NULL; *p = 42; } }
[ "#include <assert.h>", "#include <stdlib.h>", "void assume_non_negative(int x) {\n if (x < 0) {\n exit(1);\n }\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
32
39
arithmetic_005
pulse/arithmetic.c
if_negative_then_crash_latent
if_negative_then_crash
void if_negative_then_crash(int x) { assume_non_negative(-x); int* p = NULL; *p = 42; }
[ "#include <assert.h>", "#include <stdlib.h>", "void assume_non_negative(int x) {\n if (x < 0) {\n exit(1);\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE_LATENT" ]
[ 3 ]
[ 44 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
other
true
41
45
arithmetic_006
pulse/arithmetic.c
call_if_negative_then_crash_with_local_bad
call_if_negative_then_crash_with_local
void call_if_negative_then_crash_with_local() { int x = random(); if_negative_then_crash_latent(x); }
[ "#include <assert.h>", "#include <stdlib.h>", "void if_negative_then_crash_latent(int x) {\n assume_non_negative(-x);\n int* p = NULL;\n *p = 42;\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 2 ]
[ 55 ]
[ "ERROR" ]
[ "when calling `if_negative_then_crash_latent` here,is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
true
53
56
arithmetic_007
pulse/arithmetic.c
return_non_negative_float
return_non_negative_float
float return_non_negative_float() { float x = ((float)random()) / (2 ^ 31 - 1); if (x < 0.) { exit(1); } return x; }
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
58
64
arithmetic_008
pulse/arithmetic.c
return_non_negative_float_is_non_negative_ok
return_non_negative_float_is_non_negative
void return_non_negative_float_is_non_negative() { if (return_non_negative_float() < 0) { int* p = NULL; *p = 42; } }
[ "#include <assert.h>", "#include <stdlib.h>", "float return_non_negative_float() {\n float x = ((float)random()) / (2 ^ 31 - 1);\n if (x < 0.) {\n exit(1);\n }\n return x;\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
66
71
arithmetic_009
pulse/arithmetic.c
assume_non_negative_float
assume_non_negative_float
void assume_non_negative_float(float x) { if (x < 0.) { exit(1); } }
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
73
77
arithmetic_010
pulse/arithmetic.c
assume_non_negative_float_is_non_negative_ok
assume_non_negative_float_is_non_negative
void assume_non_negative_float_is_non_negative() { float x = ((float)random()) / (2 ^ 31 - 1); assume_non_negative_float(x); if (x < 0.) { int* p = NULL; *p = 42; } }
[ "#include <assert.h>", "#include <stdlib.h>", "void assume_non_negative_float(float x) {\n if (x < 0.) {\n exit(1);\n }\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
79
86
array_out_of_bounds_001
pulse/array_out_of_bounds.c
nested_array_ok
nested_array
void nested_array() { int a[3][4][5]; a[2][3][4] = 0; }
[]
false
[]
[]
[]
[]
[]
safe
false
18
21
assert_001
pulse/assert.c
report_on_line_offset_6_bad
report_on_line_offset_6
int report_on_line_offset_6(int* p) { assert(p); if (!p) { *p = 42; // unreachable } int* q = NULL; *q = 42; }
[ "#include <assert.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 6 ]
[ 19 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
13
20
assert_failure_001
pulse/assert_failure.c
simple_check
simple_check
void simple_check(int x) { assert(x < 3); }
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
13
13
assert_failure_002
pulse/assert_failure.c
simple_assertion_failure
simple_assertion_failure
void simple_assertion_failure() { int x = 4; simple_check(x); }
[ "#include <assert.h>", "#include <stdlib.h>", "void simple_check(int x) { assert(x < 3); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
15
18
assert_failure_003
pulse/assert_failure.c
no_assertion_failure
no_assertion_failure
void no_assertion_failure() { int x = 2; simple_check(x); }
[ "#include <assert.h>", "#include <stdlib.h>", "void simple_check(int x) { assert(x < 3); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
20
23
assert_failure_004
pulse/assert_failure.c
check_node
check_node
void check_node(node* n) { assert(n->value < 3); }
[ "#include <assert.h>", "#include <stdlib.h>", "typedef struct {\n int value;\n} node;" ]
false
[]
[]
[]
[]
[]
safe
false
29
29
assert_failure_005
pulse/assert_failure.c
assertion_failure_with_heap
assertion_failure_with_heap
node* assertion_failure_with_heap() { node* n = malloc(sizeof(node)); if (n != NULL) { n->value = 4; check_node(n); } return n; }
[ "#include <assert.h>", "#include <stdlib.h>", "typedef struct {\n int value;\n} node;", "void check_node(node* n) { assert(n->value < 3); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
31
38
assert_failure_006
pulse/assert_failure.c
no_assertion_failure_with_heap
no_assertion_failure_with_heap
node* no_assertion_failure_with_heap() { node* n = malloc(sizeof(node)); if (n != NULL) { n->value = 2; check_node(n); } return n; }
[ "#include <assert.h>", "#include <stdlib.h>", "typedef struct {\n int value;\n} node;", "void check_node(node* n) { assert(n->value < 3); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
40
47
assert_failure_007
pulse/assert_failure.c
my_assert
my_assert
void my_assert(int x) { if (!x) { __infer_fail("ASSERTION_FAILURE"); } }
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
51
55
assert_failure_008
pulse/assert_failure.c
should_not_report_assertion_failure
should_not_report_assertion_failure
void should_not_report_assertion_failure(int x) { my_assert(x); }
[ "#include <assert.h>", "#include <stdlib.h>", "void my_assert(int x) {\n if (!x) {\n __infer_fail(\"ASSERTION_FAILURE\");\n }\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
57
57
assert_failure_009
pulse/assert_failure.c
should_report_assertion_failure
should_report_assertion_failure
void should_report_assertion_failure(int x) { x = 0; my_assert(x); }
[ "#include <assert.h>", "#include <stdlib.h>", "void my_assert(int x) {\n if (!x) {\n __infer_fail(\"ASSERTION_FAILURE\");\n }\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
59
62
assert_failure_010
pulse/assert_failure.c
check_global
check_global
void check_global() { assert(global != 0); }
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
66
66
assert_failure_011
pulse/assert_failure.c
skip
skip
void skip() {}
[ "#include <assert.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
68
68
assert_failure_012
pulse/assert_failure.c
assignment_after_check
assignment_after_check
void assignment_after_check() { check_global(); global = 0; skip(); }
[ "#include <assert.h>", "#include <stdlib.h>", "void check_global() { assert(global != 0); }\n", "void skip() {}\n" ]
false
[]
[]
[]
[]
[]
safe
true
70
74
assert_failure_013
pulse/assert_failure.c
assignemt_before_check
assignemt_before_check
void assignemt_before_check() { global = 0; check_global(); }
[ "#include <assert.h>", "#include <stdlib.h>", "void check_global() { assert(global != 0); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
76
79
assert_failure_014
pulse/assert_failure.c
failure_on_both_branches
failure_on_both_branches
void failure_on_both_branches(int x) { if (x > 3) { simple_check(x); } else { simple_check(42); } }
[ "#include <assert.h>", "#include <stdlib.h>", "void simple_check(int x) { assert(x < 3); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
81
87
cleanup_attribute_001
pulse/cleanup_attribute.c
cleanup_char
cleanup_char
void cleanup_char(char** x) { free(*x); }
[ "#include <stdlib.h>", "#include <string.h>" ]
false
[]
[]
[]
[]
[]
safe
false
10
10
cleanup_attribute_002
pulse/cleanup_attribute.c
cleanup_int
cleanup_int
void cleanup_int(int** x) { free(*x); }
[ "#include <stdlib.h>", "#include <string.h>" ]
false
[]
[]
[]
[]
[]
safe
false
12
12
cleanup_attribute_003
pulse/cleanup_attribute.c
no_cleanup
no_cleanup
void no_cleanup(int** x) { /* nothing */ }
[ "#include <stdlib.h>", "#include <string.h>" ]
false
[]
[]
[]
[]
[]
safe
false
14
14
cleanup_attribute_004
pulse/cleanup_attribute.c
cleanup_malloc_ok
cleanup_malloc
void cleanup_malloc() { __attribute__((cleanup(cleanup_int))) int* x; // attribute cleanup is done on *x not x, resulting in NPE, Uninit, and // memleak FPs x = malloc(sizeof(int)); if (x != NULL) { *x = 10; } /* x goes out of scope. Cleanup function called - no leak */ }
[ "#include <stdlib.h>", "#include <string.h>" ]
false
[]
[]
[]
[]
[]
safe
false
16
25
cleanup_attribute_005
pulse/cleanup_attribute.c
cleanup_string_ok
cleanup_string
void cleanup_string() { __attribute__((cleanup(cleanup_char))) char* s; s = strdup("demo string"); /* s goes out of scope. Cleanup function called - no leak */ }
[ "#include <stdlib.h>", "#include <string.h>" ]
false
[]
[]
[]
[]
[]
safe
false
34
38
compound_literal_001
pulse/compound_literal.c
return_zero
return_zero
int return_zero() { return ((struct point){.y = 32, .x = 0}).x; }
[ "#include <stdlib.h>", "struct point {\n int x;\n int y;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
15
15
compound_literal_002
pulse/compound_literal.c
detect_zero_bad
detect_zero
int detect_zero() { if (return_zero() == 0) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>", "struct point {\n int x;\n int y;\n};", "int return_zero() { return ((struct point){.y = 32, .x = 0}).x; }\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 20 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
true
17
22
compound_literal_003
pulse/compound_literal.c
detect_zero_ok
detect_zero
int detect_zero() { if (return_zero() != 0) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>", "struct point {\n int x;\n int y;\n};", "int return_zero() { return ((struct point){.y = 32, .x = 0}).x; }\n" ]
false
[]
[]
[]
[]
[]
safe
true
24
29
dangling_deref_001
pulse/dangling_deref.c
set42
set42
int* set42(int* x) { *x = 42; return x; }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
11
14
dangling_deref_002
pulse/dangling_deref.c
no_dangling_deref_ok
no_dangling_deref
void no_dangling_deref() { int w, *z; z = set42(&w); }
[ "#include <stdio.h>", "#include <stdlib.h>", "int* set42(int* x) {\n *x = 42;\n return x;\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
16
19
dangling_deref_003
pulse/dangling_deref.c
no_dangling_deref1_ok
no_dangling_deref1
void no_dangling_deref1() { int* y = malloc(sizeof(int)); int* z; if (y) { z = set42(y); free(y); } }
[ "#include <stdio.h>", "#include <stdlib.h>", "int* set42(int* x) {\n *x = 42;\n return x;\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
21
28
dangling_deref_004
pulse/dangling_deref.c
dangling_deref_bad
dangling_deref
void dangling_deref() { int* y; int* z; z = set42(y); }
[ "#include <stdio.h>", "#include <stdlib.h>", "int* set42(int* x) {\n *x = 42;\n return x;\n}\n" ]
true
[ "PULSE_UNINITIALIZED_VALUE" ]
[ 3 ]
[ 33 ]
[ "ERROR" ]
[ "variable `y` declared here,read to uninitialized value occurs here" ]
uninitialized_value
true
30
34
dangling_deref_005
pulse/dangling_deref.c
intraproc_dangling_deref_bad
intraproc_dangling_deref
void intraproc_dangling_deref() { int* y; int* z; *y = 42; z = y; }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "PULSE_UNINITIALIZED_VALUE" ]
[ 3 ]
[ 39 ]
[ "ERROR" ]
[ "variable `y` declared here,read to uninitialized value occurs here" ]
uninitialized_value
false
36
41
dangling_deref_006
pulse/dangling_deref.c
union_ok
union
short union(int* param) { union { int* a; short* b; } u; u.a = param; short* p = u.b; return *p; }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
43
51
enum_001
pulse/enum.c
other_enum_main
other_enum_main
int other_enum_main() { enum Foo foo_a = A; enum Foo foo_b = B; enum Foo foo_c = C; enum Foo foo_d = D; enum Foo foo_e = E; enum Foo foo_f = F; enum Foo foo_g = G; }
[ "#include <stdlib.h>", "enum Foo { A, B, C = 10, D, E = 1, F, G = F + C };" ]
false
[]
[]
[]
[]
[]
safe
false
12
20
enum_002
pulse/enum.c
enum_values_ok
enum_values
void enum_values() { enum Foo foo_g = G; enum Foo foo_a = A; if (foo_g != 12 || foo_a != 0) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>", "enum Foo { A, B, C = 10, D, E = 1, F, G = F + C };" ]
false
[]
[]
[]
[]
[]
safe
false
22
29
enum_003
pulse/enum.c
enum_values_bad
enum_values
void enum_values() { enum Foo foo_g = G; enum Foo foo_a = A; if (foo_g == 12 && foo_a == 0) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>", "enum Foo { A, B, C = 10, D, E = 1, F, G = F + C };" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 5 ]
[ 36 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
31
38
exit_example_001
pulse/exit_example.c
exit_example_bad
exit_example
void exit_example() { int* p = NULL; if (p) { exit(1); } *p = 42; }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 5 ]
[ 14 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
9
15
exit_example_002
pulse/exit_example.c
direct_exit_example_ok
direct_exit_example
void direct_exit_example() { int* p = NULL; exit(1); *p = 42; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
17
21
exit_example_003
pulse/exit_example.c
exit_wrapper
exit_wrapper
void exit_wrapper() { exit(1); }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
23
23
exit_example_004
pulse/exit_example.c
indirect_exit_example_ok
indirect_exit_example
void indirect_exit_example() { int* p = NULL; exit_wrapper(); *p = 42; }
[ "#include <stdlib.h>", "void exit_wrapper() { exit(1); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
25
29
exit_example_005
pulse/exit_example.c
direct_abort_example_ok
direct_abort_example
void direct_abort_example() { int* p = NULL; abort(); *p = 42; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
31
35
exit_example_006
pulse/exit_example.c
abort_wrapper
abort_wrapper
void abort_wrapper() { abort(); }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
37
37
exit_example_007
pulse/exit_example.c
indirect_abort_example_ok
indirect_abort_example
void indirect_abort_example() { int* p = NULL; abort_wrapper(); *p = 42; }
[ "#include <stdlib.h>", "void abort_wrapper() { abort(); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
39
43
field_taint_001
pulse/field_taint.c
test_taint_field_bad
test_taint_field
void test_taint_field(structure s) { taint_manipulated(s); sink_int(s.manipulated); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
true
[ "TAINT_ERROR" ]
[ 2 ]
[ 28 ]
[ "ERROR" ]
[ "source of the taint here: field `manipulated` of value passed as argument `#0` to `taint_manipulated` with kind `Simple`,flows to this sink: value passed as argument `#0` to `sink_int` with kind `Simple`" ]
other
false
26
29
field_taint_002
pulse/field_taint.c
test_taint_field_good
test_taint_field
void test_taint_field(structure s) { taint_manipulated(s); sink_int(s.other); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
false
[]
[]
[]
[]
[]
safe
false
31
34
field_taint_003
pulse/field_taint.c
test_sink_field_bad
test_sink_field
void test_sink_field(structure s) { int tainted = int_source(); s.manipulated = tainted; sink_manipulated(s); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
true
[ "TAINT_ERROR" ]
[ 3 ]
[ 39 ]
[ "ERROR" ]
[ "source of the taint here: value returned from `int_source` with kind `Simple`,flows to this sink: field `manipulated` of value passed as argument `#0` to `sink_manipulated` with kind `Simple`" ]
other
false
36
40
field_taint_004
pulse/field_taint.c
test_sink_field_good
test_sink_field
void test_sink_field(structure s) { int tainted = int_source(); s.other = tainted; sink_manipulated(s); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
false
[]
[]
[]
[]
[]
safe
false
42
46
field_taint_005
pulse/field_taint.c
test_sanitize_field_bad
test_sanitize_field
void test_sanitize_field(structure s) { // The 2 lines below are necessary because tainting propagates down // what is known in the memory at the moment of tainting and it is never // propagated again when a new manipulated appears. `s.other` and // `s.manipulated` need to have different values otherwise they are both // referencing the same value and sanitizing one would sanitize the other s.other = 2; // makes s.other exist in memory before tainting s s.manipulated = 1; // makes s.manipulated exist in memory before tainting s taint_structure(s); sanitize_manipulated(s); sink_int(s.other); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
true
[ "TAINT_ERROR" ]
[ 10 ]
[ 58 ]
[ "ERROR" ]
[ "source of the taint here: value passed as argument `#0` to `taint_structure` with kind `Simple`,flows to this sink: value passed as argument `#0` to `sink_int` with kind `Simple`" ]
other
false
48
59
field_taint_006
pulse/field_taint.c
test_sanitize_field_good
test_sanitize_field
void test_sanitize_field(structure s) { s.other = 2; // makes s.other exist in memory before tainting s s.manipulated = 1; // makes s.manipulated exist in memory before tainting s taint_structure(s); sanitize_manipulated(s); sink_manipulated(s); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
false
[]
[]
[]
[]
[]
safe
false
61
67
field_taint_007
pulse/field_taint.c
test_propagate_to_field_bad
test_propagate_to_field
void test_propagate_to_field(structure s) { int tainted = int_source(); propagate_to_manipulated(s, tainted); sink_int(s.manipulated); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
true
[ "TAINT_ERROR" ]
[ 3 ]
[ 71 ]
[ "ERROR" ]
[ "source of the taint here: value returned from `int_source` with kind `Simple`,in call to `propagate_to_manipulated`,flows to this sink: value passed as argument `#0` to `sink_int` with kind `Simple`" ]
other
false
68
72
field_taint_008
pulse/field_taint.c
test_propagate_to_field_good
test_propagate_to_field
void test_propagate_to_field(structure s) { int tainted = int_source(); propagate_to_manipulated(s, tainted); sink_int(s.other); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
false
[]
[]
[]
[]
[]
safe
false
74
78
field_taint_009
pulse/field_taint.c
test_taint_field_with_indirections_bad
test_taint_field_with_indirections
void test_taint_field_with_indirections(structure s) { structure* s_ptr = &s; structure** s_ptr_ptr = &s_ptr; taint_manipulated_with_indirections(s_ptr_ptr); sink_int((**s_ptr_ptr).manipulated); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
true
[ "TAINT_ERROR" ]
[ 4 ]
[ 84 ]
[ "ERROR" ]
[ "source of the taint here: field `manipulated` of value passed as argument `#0` to `taint_manipulated_with_indirections` with kind `Simple`,flows to this sink: value passed as argument `#0` to `sink_int` with kind `Simple`" ]
other
false
80
85
field_taint_010
pulse/field_taint.c
test_taint_field_with_indirections_good
test_taint_field_with_indirections
void test_taint_field_with_indirections(structure s) { structure* s_ptr = &s; structure** s_ptr_ptr = &s_ptr; taint_manipulated_with_indirections(s_ptr_ptr); sink_int((**s_ptr_ptr).other); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
false
[]
[]
[]
[]
[]
safe
false
87
92
field_taint_011
pulse/field_taint.c
test_taint_previously_unaccessed_field_bad
test_taint_previously_unaccessed_field
void test_taint_previously_unaccessed_field(structure s) { taint_structure(s); sink_int(s.manipulated); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
true
[ "TAINT_ERROR" ]
[ 2 ]
[ 96 ]
[ "ERROR" ]
[ "source of the taint here: value passed as argument `#0` to `taint_structure` with kind `Simple`,flows to this sink: value passed as argument `#0` to `sink_int` with kind `Simple`" ]
other
false
94
97
field_taint_012
pulse/field_taint.c
test_taint_logger_policy
test_taint_logger_policy
void test_taint_logger_policy(structure s) { taint_manipulated(s); sink_log(s.manipulated); }
[ "typedef struct {\n int manipulated;\n int other;\n} structure;" ]
true
[ "TAINT_ERROR" ]
[ 2 ]
[ 101 ]
[ "ERROR" ]
[ "source of the taint here: field `manipulated` of value passed as argument `#0` to `taint_manipulated` with kind `Simple`,flows to this sink: value passed as argument `#0` to `sink_log` with kind `Logger`" ]
other
false
99
102
fopen_001
pulse/fopen.c
no_fopen_check_getc_bad
no_fopen_check_getc
void no_fopen_check_getc() { FILE* f; int i; f = fopen("this_file_doesnt_exist", "r"); i = getc(f); printf("i =%i\n", i); fclose(f); }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 15 ]
[ "ERROR" ]
[ "in call to `fopen` (modelled),is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
11
18
fopen_002
pulse/fopen.c
fopen_check_getc_ok
fopen_check_getc
void fopen_check_getc() { FILE* f; int i; f = fopen("this_file_doesnt_exist", "r"); if (f) { i = getc(f); printf("i =%i\n", i); fclose(f); } }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
20
29
fopen_003
pulse/fopen.c
fopen_no_fclose_bad
fopen_no_fclose
void fopen_no_fclose() { FILE* f; int i; f = fopen("some_file", "r"); if (f) { i = getc(f); printf("i =%i\n", i); } }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "PULSE_RESOURCE_LEAK" ]
[ 5 ]
[ 36 ]
[ "ERROR" ]
[ "allocation part of the trace starts here,allocated by `fopen()` here,file descriptor becomes unreachable here" ]
resource_leak
false
31
39
fopen_004
pulse/fopen.c
no_fopen_check_fgetc_bad
no_fopen_check_fgetc
void no_fopen_check_fgetc() { FILE* f; int i; f = fopen("this_file_doesnt_exist", "r"); i = fgetc(f); printf("i =%i\n", i); fclose(f); }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 45 ]
[ "ERROR" ]
[ "in call to `fopen` (modelled),is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
41
48
fopen_005
pulse/fopen.c
fopen_check_fgetc_ok
fopen_check_fgetc
void fopen_check_fgetc() { FILE* f; int i; f = fopen("this_file_doesnt_exist", "r"); if (f) { i = fgetc(f); printf("i =%i\n", i); fclose(f); } }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
50
59
fopen_006
pulse/fopen.c
no_fopen_check_ungetc_bad
no_fopen_check_ungetc
void no_fopen_check_ungetc() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); int i = ungetc(10, f); fclose(f); }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 64 ]
[ "ERROR" ]
[ "in call to `fopen` (modelled),is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
61
66
fopen_007
pulse/fopen.c
fopen_check_ungetc_ok
fopen_check_ungetc
void fopen_check_ungetc() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); if (f) { int i = ungetc(10, f); fclose(f); } }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
68
75
fopen_008
pulse/fopen.c
no_fopen_check_fputs_bad
no_fopen_check_fputs
void no_fopen_check_fputs() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); fputs("blablabla", f); fclose(f); }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 80 ]
[ "ERROR" ]
[ "in call to `fopen` (modelled),is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
77
82
fopen_009
pulse/fopen.c
fopen_check_fputs_ok
fopen_check_fputs
void fopen_check_fputs() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); if (f) { fputs("blablabla", f); fclose(f); } }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
84
92
fopen_010
pulse/fopen.c
no_fopen_check_fputc_bad
no_fopen_check_fputc
void no_fopen_check_fputc() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); fputc(42, f); fclose(f); }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 98 ]
[ "ERROR" ]
[ "in call to `fopen` (modelled),is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
94
100
fopen_011
pulse/fopen.c
fopen_check_fputc_ok
fopen_check_fputc
void fopen_check_fputc() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); if (f) { fputc(42, f); fclose(f); } }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
102
110
fopen_012
pulse/fopen.c
no_fopen_check_putc_bad
no_fopen_check_putc
void no_fopen_check_putc() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); putc(42, f); fclose(f); }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 116 ]
[ "ERROR" ]
[ "in call to `fopen` (modelled),is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
112
118
fopen_013
pulse/fopen.c
fopen_check_putc_ok
fopen_check_putc
void fopen_check_putc() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); if (f) { putc(42, f); fclose(f); } }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
120
128
fopen_014
pulse/fopen.c
no_fopen_check_fseek_bad
no_fopen_check_fseek
void no_fopen_check_fseek() { FILE* f; f = fopen("this_file_doesnt_exist", "r"); fseek(f, 7, SEEK_SET); fclose(f); }
[ "#include <stdio.h>", "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 134 ]
[ "ERROR" ]
[ "in call to `fopen` (modelled),is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
130
136