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
infinite_036
pulse/infinite.c
loop_with_break_var2_ok
loop_with_break_var2
void loop_with_break_var2(int y) { while (y < 100) if (y == 50) { y--; break; } else y++; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
324
331
infinite_037
pulse/infinite.c
loop_with_break_var3_ok
loop_with_break_var3
void loop_with_break_var3(int y) { while (y < 100) if (y == 50) break; else y++; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
334
340
infinite_038
pulse/infinite.c
loop_with_return_ok
loop_with_return
void loop_with_return(int y) { while (y < 100) if (y == 50) { y--; return; } else y++; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
343
350
infinite_039
pulse/infinite.c
loop_with_return_ok_var1
loop_with_return_ok_var1
void loop_with_return_ok_var1(int y) { while (y < 100) if (y == 50) return; else y++; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
353
359
infinite_040
pulse/infinite.c
loop_with_return_var2_ok
loop_with_return_var2
void loop_with_return_var2(int y) { y = 0; while (y < 100) if (y == 50) { y--; return; } else y++; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
362
370
infinite_041
pulse/infinite.c
loop_with_return_var3_ok
loop_with_return_var3
void loop_with_return_var3(int y) { y = 0; while (y < 100) if (y == 50) return; else y++; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
373
380
infinite_042
pulse/infinite.c
while_even_bad
while_even
void while_even() { int i = 0; while (i % 2 == 0) i = i + 2; }
[ "#include <stdlib.h>" ]
true
[ "INFINITE_LOOP" ]
[ 2 ]
[ 390 ]
[ "WARNING" ]
[ "in loop" ]
other
false
388
392
infinite_043
pulse/infinite.c
incr_if_non_zero
incr_if_non_zero
int incr_if_non_zero(int x, int y) { if (y == 0) return x; else return x + 1; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
394
399
infinite_044
pulse/infinite.c
incr_with_call_bad
incr_with_call
void incr_with_call(int y) { int i = 0; while (i < 100) i = incr_if_non_zero(i, y); }
[ "#include <stdlib.h>", "int incr_if_non_zero(int x, int y) {\n if (y == 0)\n return x;\n else\n return x + 1;\n}\n" ]
true
[ "INFINITE_LOOP" ]
[ 2 ]
[ 403 ]
[ "WARNING" ]
[ "in loop" ]
other
true
401
405
infinite_045
pulse/infinite.c
incr_if_geq_zero
incr_if_geq_zero
int incr_if_geq_zero(int x) { if (x < 0) return x; else return x + 1; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
407
412
infinite_046
pulse/infinite.c
incr_with_call_ok
incr_with_call
void incr_with_call() { int i = 0; while (i < 100) i = incr_if_geq_zero(i); }
[ "#include <stdlib.h>", "int incr_if_geq_zero(int x) {\n if (x < 0)\n return x;\n else\n return x + 1;\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
414
418
infinite_047
pulse/infinite.c
loop_repeated_ok
loop_repeated
int loop_repeated(int i) { int val = 0; for (i = 0; i < 3; i++) val++; for (i = 0; i < 3; i++) val++; return (val); }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
420
427
infinite_048
pulse/infinite.c
two_ints_loop_cook06_ok
two_ints_loop_cook06
void two_ints_loop_cook06(int x, int y) { if (y >= 1) while (x >= 0) x = x + y; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
482
486
infinite_049
pulse/infinite.c
Ack
Ack
int Ack(int x, int y) { if (x > 0) { int n; if (y > 0) { y--; n = Ack(x, y); } else { n = 1; } x--; return Ack(x, n); } else { return y + 1; } }
[ "#include <stdlib.h>" ]
true
[ "MUTUAL_RECURSION_CYCLE", "MUTUAL_RECURSION_CYCLE" ]
[ 5, 10 ]
[ 494, 499 ]
[ "WARNING", "WARNING" ]
[ "`Ack` makes a recursive call to `Ack`", "`Ack` makes a recursive call to `Ack`" ]
other
false
489
503
infinite_050
pulse/infinite.c
nondet
nondet
int nondet() { return (rand()); }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
508
508
infinite_051
pulse/infinite.c
benchmark_nondet_cook06_ok
benchmark_nondet_cook06
int benchmark_nondet_cook06() { int x = nondet(); int y = nondet(); int* p = &y; int* q = &x; int b = 1; while (x < 100 && 100 < y && b) { if (p == q) { int k = Ack(nondet(), nondet()); (*p)++; while ((k--) > 100) { if (nondet()) { p = &y; } if (nondet()) { p = &x; } if (!b) { k++; } } } else { (*q)--; (*p)--; if (nondet()) { p = &y; } if (nondet()) { p = &x; } } b = nondet(); } return (0); }
[ "#include <stdlib.h>", "int Ack(int x, int y) {\n if (x > 0) {\n int n;\n if (y > 0) {\n y--;\n n = Ack(x, y);\n } else {\n n = 1;\n }\n x--;\n return Ack(x, n);\n } else {\n return y + 1;\n }\n}\n", "int nondet() { return (rand()); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
509
545
infinite_052
pulse/infinite.c
benchmark_cook06_ok
benchmark_cook06
void benchmark_cook06() { int x = nondet(), y = nondet(), z = nondet(); if (y > 0) { do { if (npc == 5) { if (!((y < z && z <= nz) || (x < y && x >= nx) || 0)) ; } if (npc == 0) { if (nondet()) { nx = x; ny = y; nz = z; npc = 5; } } if (nondet()) { x = x + y; } else { z = x - y; } } while (x < y && y < z); } }
[ "#include <stdlib.h>", "int npc = 0;", "int nondet() { return (rand()); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
553
576
infinite_053
pulse/infinite.c
benchmark_simple_cook06_ok
benchmark_simple_cook06
void benchmark_simple_cook06() { int x = nondet(), y = nondet(), z = nondet(); if (y > 0) { do { if (nondet()) { x = x + y; } else { z = x - y; } } while (x < y && y < z); } }
[ "#include <stdlib.h>", "int nondet() { return (rand()); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
582
593
infinite_054
pulse/infinite.c
nondet_loop_bad
nondet_loop
void nondet_loop(int z) { int x = 1; while (x < z) if (nondet()) x++; }
[ "#include <stdlib.h>", "int nondet() { return (rand()); }\n" ]
true
[ "INFINITE_LOOP" ]
[ 2 ]
[ 600 ]
[ "WARNING" ]
[ "in loop" ]
other
true
598
603
infinite_055
pulse/infinite.c
hensel_tacas22_bad
hensel_tacas22
void hensel_tacas22(int x, int y) { y = 0; while (x > 0) { x--; y++; } while (y > 1) y = y; }
[ "#include <stdlib.h>" ]
true
[ "INFINITE_LOOP" ]
[ 6 ]
[ 614 ]
[ "WARNING" ]
[ "in loop" ]
other
false
608
616
infinite_056
pulse/infinite.c
foo
foo
void foo(int* x) { (*x)--; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
620
620
infinite_057
pulse/infinite.c
interproc_terminating_harris10_ok
interproc_terminating_harris10
void interproc_terminating_harris10(int x) { while (x > 0) foo(&x); }
[ "#include <stdlib.h>", "void foo(int* x) { (*x)--; }\n" ]
false
[]
[]
[]
[]
[]
safe
true
624
627
infinite_058
pulse/infinite.c
interproc_terminating_harris10_cond_ok
interproc_terminating_harris10_cond
void interproc_terminating_harris10_cond(int x) { while (x > 0) { if (nondet()) foo(&x); else foo(&x); } }
[ "#include <stdlib.h>", "int nondet() { return (rand()); }\n", "void foo(int* x) { (*x)--; }\n" ]
false
[]
[]
[]
[]
[]
safe
true
631
638
infinite_059
pulse/infinite.c
loop_non_terminating_harris10_bad
loop_non_terminating_harris10
void loop_non_terminating_harris10(int x, int d, int z) { d = 0; z = 0; while (x > 0) { z++; x = x - d; } }
[ "#include <stdlib.h>" ]
true
[ "INFINITE_LOOP" ]
[ 3 ]
[ 648 ]
[ "WARNING" ]
[ "in loop" ]
other
false
645
652
infinite_060
pulse/infinite.c
nondet_nonterminate_chen14_bad
nondet_nonterminate_chen14
void nondet_nonterminate_chen14(int k, int i) { if (k >= 0) ; else i = -1; while (i >= 0) i = nondet(); i = 2; }
[ "#include <stdlib.h>", "int nondet() { return (rand()); }\n" ]
true
[ "INFINITE_LOOP" ]
[ 5 ]
[ 666 ]
[ "WARNING" ]
[ "in loop" ]
other
true
661
669
infinite_061
pulse/infinite.c
nestedloop2_chen14_ok
nestedloop2_chen14
void nestedloop2_chen14(int k, int j) { while (k >= 0) { k++; j = k; while (j >= 1) j--; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
675
682
infinite_062
pulse/infinite.c
array_iter_ok
array_iter
void array_iter(int array[]) { unsigned int i = 0; while (array[i] != 0) { array[i] = 42; i++; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
698
704
infinite_063
pulse/infinite.c
array2_iter_ok
array2_iter
void array2_iter(int array1[], int array2[]) { unsigned int i = 0; while (array1[i] != 0) { array2[i] = 42; i++; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
707
713
infinite_064
pulse/infinite.c
array_iter_bad
array_iter
void array_iter(int array[], int len) { int i = 0; while (i < len) { array[i] = 42; if (i > 10) i = 0; i++; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
717
725
infinite_065
pulse/infinite.c
iterate_arraysize_ok
iterate_arraysize
void iterate_arraysize(int array[256]) { unsigned int i = 0; while (i < (sizeof(*array) / sizeof(array[0]))) { array[i] = i; i++; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
729
735
infinite_066
pulse/infinite.c
iterate_bitmask_ok
iterate_bitmask
void iterate_bitmask(int array[256], int len) { unsigned int i = 0; while (i < len) { array[i] = (i & (~7)); i++; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
739
745
infinite_067
pulse/infinite.c
iterate_bitmask2_ok
iterate_bitmask2
void iterate_bitmask2(int array[256], int len) { unsigned int i = 0; unsigned int j = 0; while (i < len) { j = (i & (~7)); array[j] = i; i++; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
749
757
infinite_068
pulse/infinite.c
iterate_bitmask_bad
iterate_bitmask
void iterate_bitmask(int array[256], unsigned int len) { unsigned int i = 0; while (i < len) { i = (i & (~7)); array[i] = i; i++; } }
[ "#include <stdlib.h>" ]
true
[ "INFINITE_LOOP" ]
[ 2 ]
[ 763 ]
[ "WARNING" ]
[ "in loop" ]
other
false
761
768
infinite_069
pulse/infinite.c
bitshift_right_loop_ok
bitshift_right_loop
void bitshift_right_loop(int i) { while (i) i = i >> 1; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
771
774
infinite_070
pulse/infinite.c
bitshift_left_loop_ok
bitshift_left_loop
void bitshift_left_loop(int i) { while (i) i = i << 1; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
777
780
infinite_071
pulse/infinite.c
bitshift_loop_ok
bitshift_loop
void bitshift_loop(unsigned int i) { while (i % 2) i = (i << 1); }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
783
786
infinite_072
pulse/infinite.c
iterate_bitshift1_ok
iterate_bitshift1
void iterate_bitshift1(int array[256], int len) { unsigned int i = 1; while (i < len) { array[i] = i; i = i << 1; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
801
807
infinite_073
pulse/infinite.c
iterate_bitshift2_ok
iterate_bitshift2
void iterate_bitshift2(int array[256], unsigned char i) { while (i != 0) { array[i] = i; i = i >> 1; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
811
816
infinite_074
pulse/infinite.c
iterate_intoverflow_ok
iterate_intoverflow
void iterate_intoverflow(int len) { unsigned int i = 0xFFFFFFFF; while (i != 0) i++; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
819
823
infinite_075
pulse/infinite.c
iterate_crc_ok
iterate_crc
void iterate_crc() { unsigned int k; unsigned long crc0 = 0xFFFFFFFF; for (k = 1; k < W; k++) { crc0++; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
843
850
infinite_076
pulse/infinite.c
png_palette_ok
png_palette
void png_palette(int val) { int num; int i; int p = 0; if (val == 0) num = 1; else num = 10; for (i = 0; i < num; i++) p += val; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
855
867
infinite_077
pulse/infinite.c
simple_loop_equal_bad
simple_loop_equal
void simple_loop_equal() { int x = 42; while (x == x) x = x + 1; }
[ "#include <stdlib.h>" ]
true
[ "INFINITE_LOOP" ]
[ 2 ]
[ 873 ]
[ "WARNING" ]
[ "in loop" ]
other
false
871
875
infinite_078
pulse/infinite.c
compute_increment
compute_increment
int compute_increment(int k) { return (k % 2 ? 1 : 0); }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
878
878
infinite_079
pulse/infinite.c
loop_fcall_add_inductive_bad
loop_fcall_add_inductive
void loop_fcall_add_inductive() { int i; int incr; for (i = 0; i < 10; i += incr) incr = compute_increment(i); }
[ "#include <stdlib.h>", "int compute_increment(int k) { return (k % 2 ? 1 : 0); }\n" ]
true
[ "INFINITE_LOOP" ]
[ 3 ]
[ 883 ]
[ "WARNING" ]
[ "in loop" ]
other
true
880
885
infinite_080
pulse/infinite.c
allocate_all_in_array_ok
allocate_all_in_array
void allocate_all_in_array(int* array[]) { for (int i = 0; i < 2; i++) { array[i] = malloc(sizeof(int)); } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
889
893
infinite_081
pulse/infinite.c
goto_in_loop_without_eqtest_bad
goto_in_loop_without_eqtest
void goto_in_loop_without_eqtest() { int i = 0; int j = 0; while (i < 10) { retry: j++; goto retry; } }
[ "#include <stdlib.h>" ]
true
[ "INFINITE_LOOP" ]
[ 6 ]
[ 914 ]
[ "WARNING" ]
[ "in loop" ]
other
false
908
916
infinite_082
pulse/infinite.c
goto_cross_loop_bad
goto_cross_loop
void goto_cross_loop() { int i = 0; retry: while (i < 10) { if (i == 5) goto retry; i++; } }
[ "#include <stdlib.h>" ]
true
[ "INFINITE_LOOP" ]
[ 6 ]
[ 925 ]
[ "WARNING" ]
[ "in loop" ]
other
false
919
928
infinite_083
pulse/infinite.c
constant_loop_ok
constant_loop
int constant_loop(int i, int j) { for (i = 0; i < defined_const; i++) j++; return (j); }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
932
936
initlistexpr_001
pulse/initlistexpr.c
array_init_bad
array_init
int array_init() { int t[2][3][2] = {{{1, 1}, {2, 2}, {3, 3}}, {{4, 4}, {5, 5}, {1, 0}}}; if (t[0][1][0] == 2 && t[1][2][1] == 0) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 14 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
10
16
initlistexpr_002
pulse/initlistexpr.c
array_init_ok
array_init
int array_init() { int t[2][3][2] = {{{1, 1}, {2, 2}, {3, 3}}, {{4, 4}, {5, 5}, {1, 0}}}; if (t[0][1][0] != 2 || t[1][2][1] != 0) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
18
24
integers_001
pulse/integers.c
even_cannot_be_odd_local_ok
even_cannot_be_odd_local
void even_cannot_be_odd_local(int y) { int x = y; if (x + x == 5) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
10
16
integers_002
pulse/integers.c
even_cannot_be_odd_parameter_ok
even_cannot_be_odd_parameter
void even_cannot_be_odd_parameter(int x) { if (x + x == 5) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
18
23
integers_003
pulse/integers.c
even_cannot_be_odd_float_conv_ok
even_cannot_be_odd_float_conv
void even_cannot_be_odd_float_conv() { int x = random(); if (x + x == (int)5.5) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
25
31
integers_004
pulse/integers.c
float_div_bad
float_div
void float_div() { float y = 5.0 / 2.0; if (y != 2.0) { // always true int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 70 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
66
72
integers_005
pulse/integers.c
float_comparison_bad
float_comparison
void float_comparison(float f) { if (2 + f < 2.2) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 77 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
74
79
interprocedural_001
pulse/interprocedural.c
conditional_free
conditional_free
void conditional_free(int x, int* y) { if (x > 5) { free(y); } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
9
13
interprocedural_002
pulse/interprocedural.c
conditional_free_then_use_latent
conditional_free_then_use
void conditional_free_then_use(int x) { int* y = (int*)malloc(sizeof(int)); conditional_free(x, y); if (y != NULL) { // arguably we should report here since the code is bad, but the current // heuristic classifies this as latent *y = 1; } // avoid memory leak if (x <= 5) { free(y); } }
[ "#include <stdlib.h>", "void conditional_free(int x, int* y) {\n if (x > 5) {\n free(y);\n }\n}\n" ]
true
[ "USE_AFTER_FREE_LATENT" ]
[ 6 ]
[ 21 ]
[ "ERROR" ]
[ "invalidation part of the trace starts here,allocated by call to `malloc` (modelled),assigned,when calling `conditional_free` here,parameter `y` of conditional_free,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,allocated by call to `malloc` (modelled),assigned,invalid access occurs here" ]
other
true
15
27
interprocedural_003
pulse/interprocedural.c
call_conditional_free_then_use_bad
call_conditional_free_then_use
void call_conditional_free_then_use() { conditional_free_then_use_latent(7); }
[ "#include <stdlib.h>", "void conditional_free_then_use_latent(int x) {\n int* y = (int*)malloc(sizeof(int));\n conditional_free(x, y);\n if (y != NULL) {\n // arguably we should report here since the code is bad, but the current\n // heuristic classifies this as latent\n *y = 1;\n }\n // avoid memory leak\n if (x <= 5) {\n free(y);\n }\n}\n" ]
true
[ "USE_AFTER_FREE" ]
[ 1 ]
[ 30 ]
[ "ERROR" ]
[ "invalidation part of the trace starts here,allocated by call to `malloc` (modelled),assigned,when calling `conditional_free` here,parameter `y` of conditional_free,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,when calling `conditional_free_then_use_latent` here,allocated by call to `malloc` (modelled),assigned,invalid access occurs here" ]
use_after_free
true
29
31
interprocedural_004
pulse/interprocedural.c
test_modified_value_then_error_bad
test_modified_value_then_error
void test_modified_value_then_error(int* x) { *x = random(); if (*x == 5) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 39 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
35
41
interprocedural_005
pulse/interprocedural.c
latent_dereference
latent_dereference
void latent_dereference(int a, int* p) { if (a == 4) { *p = 42; } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
46
50
interprocedural_006
pulse/interprocedural.c
propagate_latent_1_latent
propagate_latent_1
void propagate_latent_1(int a1) { latent_dereference(a1, NULL); }
[ "#include <stdlib.h>", "void latent_dereference(int a, int* p) {\n if (a == 4) {\n *p = 42;\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE_LATENT" ]
[ 0 ]
[ 52 ]
[ "ERROR" ]
[ "is assigned to the null pointer,when calling `latent_dereference` here,parameter `p` of latent_dereference,invalid access occurs here" ]
other
true
52
52
interprocedural_007
pulse/interprocedural.c
propagate_latent_2_latent
propagate_latent_2
void propagate_latent_2(int a2) { propagate_latent_1_latent(a2); }
[ "#include <stdlib.h>", "void propagate_latent_1_latent(int a1) { latent_dereference(a1, NULL); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
54
54
interprocedural_008
pulse/interprocedural.c
propagate_latent_3_latent
propagate_latent_3
void propagate_latent_3(int a3) { propagate_latent_2_latent(a3); }
[ "#include <stdlib.h>", "void propagate_latent_2_latent(int a2) { propagate_latent_1_latent(a2); }\n" ]
false
[]
[]
[]
[]
[]
safe
true
56
56
interprocedural_009
pulse/interprocedural.c
make_latent_manifest
make_latent_manifest
void make_latent_manifest() { propagate_latent_3_latent(4); }
[ "#include <stdlib.h>", "void propagate_latent_3_latent(int a3) { propagate_latent_2_latent(a3); }\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 0 ]
[ 58 ]
[ "ERROR" ]
[ "when calling `propagate_latent_3_latent` here,when calling `propagate_latent_2_latent` here,when calling `propagate_latent_1_latent` here,is assigned to the null pointer,when calling `latent_dereference` here,parameter `p` of latent_dereference,invalid access occurs here" ]
nullptr_dereference
true
58
58
interprocedural_010
pulse/interprocedural.c
return_first
return_first
int* return_first(int* x, int a, int** out) { int* w = x; *out = w; return w; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
60
64
interprocedural_011
pulse/interprocedural.c
return_null
return_null
int* return_null(int** out) { int* p = NULL; *out = p; return p; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
66
70
interprocedural_012
pulse/interprocedural.c
follow_value_by_ref_bad
follow_value_by_ref
void follow_value_by_ref() { int* y; return_null(&y); int* z; return_first(y, 12, &z); *z = 42; }
[ "#include <stdlib.h>", "int* return_first(int* x, int a, int** out) {\n int* w = x;\n *out = w;\n return w;\n}\n", "int* return_null(int** out) {\n int* p = NULL;\n *out = p;\n return p;\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 5 ]
[ 78 ]
[ "ERROR" ]
[ "in call to `return_null`,is assigned to the null pointer,assigned,assigned,return from call to `return_null`,in call to `return_first`,parameter `x` of return_first,assigned,assigned,return from call to `return_first`,invalid access occurs here" ]
nullptr_dereference
true
73
79
interprocedural_013
pulse/interprocedural.c
follow_value_by_ret_bad
follow_value_by_ret
void follow_value_by_ret() { int *dummy1, *dummy2; int* y = return_null(&dummy1); int* z = return_first(y, 12, &dummy2); *z = 42; }
[ "#include <stdlib.h>", "int* return_first(int* x, int a, int** out) {\n int* w = x;\n *out = w;\n return w;\n}\n", "int* return_null(int** out) {\n int* p = NULL;\n *out = p;\n return p;\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 86 ]
[ "ERROR" ]
[ "in call to `return_null`,is assigned to the null pointer,assigned,returned,return from call to `return_null`,assigned,in call to `return_first`,parameter `x` of return_first,assigned,returned,return from call to `return_first`,assigned,invalid access occurs here" ]
nullptr_dereference
true
82
87
interprocedural_014
pulse/interprocedural.c
malloc_wrapper_1
malloc_wrapper_1
int* malloc_wrapper_1() { int* x; x = (int*)malloc(sizeof(int)); return x; }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
89
93
interprocedural_015
pulse/interprocedural.c
malloc_wrapper_2
malloc_wrapper_2
int* malloc_wrapper_2(int b) { if (b) { return malloc_wrapper_1(); } return NULL; }
[ "#include <stdlib.h>", "int* malloc_wrapper_1() {\n int* x;\n x = (int*)malloc(sizeof(int));\n return x;\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
95
100
interprocedural_016
pulse/interprocedural.c
free_wrapper
free_wrapper
void free_wrapper(int* p, int b) { if (b) { free(p); } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
102
106
interprocedural_017
pulse/interprocedural.c
trace_correctly_through_wrappers_bad
trace_correctly_through_wrappers
void trace_correctly_through_wrappers() { int* x = malloc_wrapper_2(1); // TODO: ideally we would trace that we didn't go into the free() branch of // the wrapper explicitly here to help understand the bug report free_wrapper(x, 0); }
[ "#include <stdlib.h>", "int* malloc_wrapper_2(int b) {\n if (b) {\n return malloc_wrapper_1();\n }\n return NULL;\n}\n", "void free_wrapper(int* p, int b) {\n if (b) {\n free(p);\n }\n}\n" ]
true
[ "MEMORY_LEAK_C" ]
[ 4 ]
[ 112 ]
[ "ERROR" ]
[ "allocation part of the trace starts here,when calling `malloc_wrapper_2` here,when calling `malloc_wrapper_1` here,allocated by `malloc` here,memory becomes unreachable here" ]
memory_leak
true
108
113
issues_abort_execution_001
pulse/issues_abort_execution.c
uninit_continues_execution_bad
uninit_continues_execution
void uninit_continues_execution() { int x; int y = x + 1; int* p = NULL; *p = 42; }
[ "#include <assert.h>", "#include <stdlib.h>" ]
true
[ "PULSE_UNINITIALIZED_VALUE", "NULLPTR_DEREFERENCE" ]
[ 2, 4 ]
[ 13, 15 ]
[ "ERROR", "ERROR" ]
[ "variable `x` declared here,read to uninitialized value occurs here", "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
11
16
issues_abort_execution_002
pulse/issues_abort_execution.c
leak_bad
leak
void leak() { int* p = malloc(sizeof(int)); assert(p); }
[ "#include <assert.h>", "#include <stdlib.h>" ]
true
[ "MEMORY_LEAK_C" ]
[ 2 ]
[ 20 ]
[ "ERROR" ]
[ "allocation part of the trace starts here,allocated by `malloc` here,macro expanded here,memory becomes unreachable here" ]
memory_leak
false
18
21
issues_abort_execution_003
pulse/issues_abort_execution.c
memleak_continues_execution_bad
memleak_continues_execution
void memleak_continues_execution() { leak_bad(); int* p = NULL; *p = 42; }
[ "#include <assert.h>", "#include <stdlib.h>", "void leak_bad() {\n int* p = malloc(sizeof(int));\n assert(p);\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 26 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
true
23
27
latent_001
pulse/latent.c
conditional_free2
conditional_free2
void conditional_free2(int b, int* x) { if (b) { free(x); } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
10
14
latent_002
pulse/latent.c
latent_use_after_free
latent_use_after_free
void latent_use_after_free(int b, int* x) { conditional_free2(b, x); *x = 42; if (!b) { // just to avoid memory leaks free(x); } }
[ "#include <stdlib.h>", "void conditional_free2(int b, int* x) {\n if (b) {\n free(x);\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE_LATENT", "USE_AFTER_FREE_LATENT" ]
[ 2, 2 ]
[ 18, 18 ]
[ "ERROR", "ERROR" ]
[ "*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `x` of latent_use_after_free,invalid access occurs here", "invalidation part of the trace starts here,parameter `x` of latent_use_after_free,when calling `conditional_free2` here,parameter `x` of conditional_free2,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,parameter `x` of latent_use_after_free,invalid access occurs here" ]
other
true
16
23
latent_003
pulse/latent.c
manifest_use_after_free
manifest_use_after_free
void manifest_use_after_free(int* x) { latent_use_after_free(1, x); }
[ "#include <stdlib.h>", "void latent_use_after_free(int b, int* x) {\n conditional_free2(b, x);\n *x = 42;\n if (!b) {\n // just to avoid memory leaks\n free(x);\n }\n}\n" ]
true
[ "USE_AFTER_FREE" ]
[ 0 ]
[ 25 ]
[ "ERROR" ]
[ "invalidation part of the trace starts here,parameter `x` of latent_use_after_free,when calling `conditional_free2` here,parameter `x` of conditional_free2,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,parameter `x` of manifest_use_after_free,when calling `latent_use_after_free` here,parameter `x` of latent_use_after_free,invalid access occurs here" ]
use_after_free
true
25
25
latent_004
pulse/latent.c
deref_then_free_then_deref_bad
deref_then_free_then_deref
void deref_then_free_then_deref(int* x) { *x = 42; free(x); *x = 42; }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE_LATENT", "USE_AFTER_FREE" ]
[ 1, 3 ]
[ 28, 30 ]
[ "ERROR", "ERROR" ]
[ "*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `x` of deref_then_free_then_deref_bad,invalid access occurs here", "invalidation part of the trace starts here,parameter `x` of deref_then_free_then_deref_bad,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,parameter `x` of deref_then_free_then_deref_bad,invalid access occurs here" ]
use_after_free
false
27
31
latent_005
pulse/latent.c
create_branching
create_branching
void create_branching(int b) { if (b) { } }
[ "#include <stdlib.h>" ]
false
[]
[]
[]
[]
[]
safe
false
33
36
latent_006
pulse/latent.c
main
main
int main(int argc, char** argv) { int* x = malloc(sizeof(int)); if (x) { latent_use_after_free(argc, x); } }
[ "#include <stdlib.h>", "void latent_use_after_free(int b, int* x) {\n conditional_free2(b, x);\n *x = 42;\n if (!b) {\n // just to avoid memory leaks\n free(x);\n }\n}\n" ]
true
[ "USE_AFTER_FREE" ]
[ 3 ]
[ 59 ]
[ "ERROR" ]
[ "invalidation part of the trace starts here,parameter `x` of latent_use_after_free,when calling `conditional_free2` here,parameter `x` of conditional_free2,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,allocated by call to `malloc` (modelled),assigned,when calling `latent_use_after_free` here,parameter `x` of latent_use_after_free,invalid access occurs here" ]
use_after_free
true
56
61
latent_007
pulse/latent.c
equal_to_stack_address_test_then_crash_bad
equal_to_stack_address_test_then_crash
void equal_to_stack_address_test_then_crash(int x, int* y) { if (y == &x) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 3 ]
[ 68 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
65
70
latent_008
pulse/latent.c
crash_if_different_addresses
crash_if_different_addresses
void crash_if_different_addresses(int* x, int* y) { *x = 42; *y = 52; if (x != y) { int* p = NULL; *p = 42; } }
[ "#include <stdlib.h>" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 5 ]
[ 77 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
false
72
79
latent_009
pulse/latent.c
traverse_and_crash_if_equal_to_root
traverse_and_crash_if_equal_to_root
void traverse_and_crash_if_equal_to_root(struct node* p) { struct node* old_p = p; while (p != NULL) { p = p->next; if (old_p == p) { int* crash = NULL; *crash = 42; } } }
[ "#include <stdlib.h>", "struct node {\n int data;\n struct node* next;\n};" ]
true
[ "NULLPTR_DEREFERENCE_LATENT" ]
[ 6 ]
[ 92 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
other
false
86
95
latent_010
pulse/latent.c
crash_after_one_node_bad
crash_after_one_node
void crash_after_one_node(struct node* q) { q->next = q; traverse_and_crash_if_equal_to_root(q); }
[ "#include <stdlib.h>", "struct node {\n int data;\n struct node* next;\n};", "void traverse_and_crash_if_equal_to_root(struct node* p) {\n struct node* old_p = p;\n while (p != NULL) {\n p = p->next;\n if (old_p == p) {\n int* crash = NULL;\n *crash = 42;\n }\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE_LATENT", "NULLPTR_DEREFERENCE" ]
[ 1, 2 ]
[ 98, 99 ]
[ "ERROR", "ERROR" ]
[ "*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `q` of crash_after_one_node_bad,invalid access occurs here", "when calling `traverse_and_crash_if_equal_to_root` here,is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
true
97
100
latent_011
pulse/latent.c
crash_after_two_nodes_bad
crash_after_two_nodes
void crash_after_two_nodes(struct node* q) { q->next->next = q; traverse_and_crash_if_equal_to_root(q); }
[ "#include <stdlib.h>", "struct node {\n int data;\n struct node* next;\n};", "void traverse_and_crash_if_equal_to_root(struct node* p) {\n struct node* old_p = p;\n while (p != NULL) {\n p = p->next;\n if (old_p == p) {\n int* crash = NULL;\n *crash = 42;\n }\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE_LATENT", "NULLPTR_DEREFERENCE_LATENT", "NULLPTR_DEREFERENCE" ]
[ 1, 1, 2 ]
[ 103, 103, 104 ]
[ "ERROR", "ERROR", "ERROR" ]
[ "*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `q` of crash_after_two_nodes_bad,invalid access occurs here", "*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `q` of crash_after_two_nodes_bad,invalid access occurs here", "when calling `traverse_and_crash_if_equal_to_root` here,is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
true
102
105
list_api_001
pulse/list_api.c
list_init
list_init
list_t* list_init() { return calloc(1, sizeof(list_t)); }
[ "#include <stdlib.h>", "typedef struct list_s {\n list_elem_t* first;\n} list_t;", "typedef struct list_elem_s {\n void* data;\n struct list_elem_s* next;\n} list_elem_t;" ]
false
[]
[]
[]
[]
[]
safe
false
19
19
list_api_002
pulse/list_api.c
list_append
list_append
void list_append(list_t* lst, list_elem_t* elem) { list_elem_t* iter; if (NULL == lst->first) { lst->first = elem; } else { iter = lst->first; while (NULL != iter->next) { iter = iter->next; } iter->next = elem; } }
[ "#include <stdlib.h>", "typedef struct list_elem_s {\n void* data;\n struct list_elem_s* next;\n} list_elem_t;", "typedef struct list_s {\n list_elem_t* first;\n} list_t;" ]
false
[]
[]
[]
[]
[]
safe
false
21
33
list_api_003
pulse/list_api.c
list_add
list_add
list_elem_t* list_add(list_t* lst, void* data) { list_elem_t* entry; entry = calloc(1, sizeof(list_elem_t)); if (NULL == entry) { return NULL; } entry->data = data; list_append(lst, entry); return (entry); }
[ "#include <stdlib.h>", "typedef struct list_elem_s {\n void* data;\n struct list_elem_s* next;\n} list_elem_t;", "typedef struct list_s {\n list_elem_t* first;\n} list_t;", "void list_append(list_t* lst, list_elem_t* elem) {\n list_elem_t* iter;\n\n if (NULL == lst->first) {\n lst->first = elem;\n } else {\n iter = lst->first;\n while (NULL != iter->next) {\n iter = iter->next;\n }\n iter->next = elem;\n }\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
35
45
list_api_004
pulse/list_api.c
list_elem_free
list_elem_free
void list_elem_free(list_elem_t* ptr) { if (NULL == ptr) { return; } list_elem_free(ptr->next); free(ptr); }
[ "#include <stdlib.h>", "typedef struct list_elem_s {\n void* data;\n struct list_elem_s* next;\n} list_elem_t;" ]
true
[ "MUTUAL_RECURSION_CYCLE" ]
[ 5 ]
[ 52 ]
[ "WARNING" ]
[ "`list_elem_free` makes a recursive call to `list_elem_free`" ]
other
false
47
54
list_api_005
pulse/list_api.c
list_free
list_free
void list_free(list_t* ptr) { list_elem_free(ptr->first); free(ptr); }
[ "#include <stdlib.h>", "typedef struct list_s {\n list_elem_t* first;\n} list_t;", "typedef struct list_elem_s {\n void* data;\n struct list_elem_s* next;\n} list_elem_t;", "void list_elem_free(list_elem_t* ptr) {\n if (NULL == ptr) {\n return;\n }\n\n list_elem_free(ptr->next);\n free(ptr);\n}\n" ]
true
[ "NULLPTR_DEREFERENCE_LATENT" ]
[ 1 ]
[ 57 ]
[ "ERROR" ]
[ "*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `ptr` of list_free,invalid access occurs here" ]
other
true
56
59
list_api_006
pulse/list_api.c
list_build_and_free_ok
list_build_and_free
int list_build_and_free() { int val_data = 21; list_t* list = list_init(); if (NULL == list) { return 1; } if (NULL == list_add(list, &val_data)) { list_free(list); return 1; } list_free(list); return 0; }
[ "#include <stdlib.h>", "typedef struct list_s {\n list_elem_t* first;\n} list_t;", "typedef struct list_elem_s {\n void* data;\n struct list_elem_s* next;\n} list_elem_t;", "list_t* list_init() { return calloc(1, sizeof(list_t)); }\n", "list_elem_t* list_add(list_t* lst, void* data) {\n list_elem_t* entry;\n\n entry = calloc(1, sizeof(list_elem_t));\n if (NULL == entry) {\n return NULL;\n }\n entry->data = data;\n list_append(lst, entry);\n return (entry);\n}\n", "void list_free(list_t* ptr) {\n list_elem_free(ptr->first);\n free(ptr);\n}\n" ]
false
[]
[]
[]
[]
[]
safe
true
61
74
list_checks_001
pulse/list_checks.c
go_to_next
go_to_next
void go_to_next(struct list* head) { if (head->next != NULL) { head = head->next; } }
[ "#include <stdlib.h>", "struct list {\n struct list* next;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
14
18
list_checks_002
pulse/list_checks.c
null_ptr_deref_bad
null_ptr_deref
void null_ptr_deref() { go_to_next(NULL); }
[ "#include <stdlib.h>", "struct list {\n struct list* next;\n};", "void go_to_next(struct list* head) {\n if (head->next != NULL) {\n head = head->next;\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 0 ]
[ 20 ]
[ "ERROR" ]
[ "is assigned to the null pointer,when calling `go_to_next` here,parameter `head` of go_to_next,invalid access occurs here" ]
nullptr_dereference
true
20
20
list_checks_003
pulse/list_checks.c
go_to_end_of_list
go_to_end_of_list
void go_to_end_of_list(struct list* head) { while (head->next != NULL) { head = head->next; } }
[ "#include <stdlib.h>", "struct list {\n struct list* next;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
22
26
list_checks_004
pulse/list_checks.c
null_ptr_deref2_bad
null_ptr_deref2
void null_ptr_deref2() { go_to_end_of_list(NULL); }
[ "#include <stdlib.h>", "struct list {\n struct list* next;\n};", "void go_to_end_of_list(struct list* head) {\n while (head->next != NULL) {\n head = head->next;\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 0 ]
[ 28 ]
[ "ERROR" ]
[ "is assigned to the null pointer,when calling `go_to_end_of_list` here,parameter `head` of go_to_end_of_list,invalid access occurs here" ]
nullptr_dereference
true
28
28
list_checks_005
pulse/list_checks.c
check_next
check_next
void check_next(struct list* head) { while (head->next != NULL) { whatever(); } }
[ "#include <stdlib.h>", "struct list {\n struct list* next;\n};" ]
true
[ "INFINITE_LOOP" ]
[ 1 ]
[ 31 ]
[ "WARNING" ]
[ "in loop" ]
other
false
30
34
list_checks_006
pulse/list_checks.c
null_ptr_deref3_bad
null_ptr_deref3
void null_ptr_deref3() { check_next(NULL); }
[ "#include <stdlib.h>", "struct list {\n struct list* next;\n};", "void check_next(struct list* head) {\n while (head->next != NULL) {\n whatever();\n }\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 0 ]
[ 36 ]
[ "ERROR" ]
[ "is assigned to the null pointer,when calling `check_next` here,parameter `head` of check_next,invalid access occurs here" ]
nullptr_dereference
true
36
36
lists_001
pulse/lists.c
add2
add2
int add2(struct l2* l) { int r = 0; for (; l; l = l->a) { r += l->b; } return r; }
[ "#include <stdlib.h>", "struct l2 {\n int b;\n struct l2* a;\n};" ]
false
[]
[]
[]
[]
[]
safe
false
15
21
lists_002
pulse/lists.c
call_add2_then_deref_null_bad
call_add2_then_deref_null
int call_add2_then_deref_null() { int res = add2(NULL); if (res == 0) { int* p = NULL; *p = 42; // reachable } }
[ "#include <stdlib.h>", "struct l2 {\n int b;\n struct l2* a;\n};", "int add2(struct l2* l) {\n int r = 0;\n for (; l; l = l->a) {\n r += l->b;\n }\n return r;\n}\n" ]
true
[ "NULLPTR_DEREFERENCE" ]
[ 4 ]
[ 27 ]
[ "ERROR" ]
[ "is assigned to the null pointer,assigned,invalid access occurs here" ]
nullptr_dereference
true
23
29