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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
uninit_023
|
pulse/uninit.c
|
read_g1_f1
|
read_g1_f1
|
void read_g1_f1(struct uninit_nested* x) { int y = x->g1.f1; }
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_nested {\n struct uninit_s g1;\n int g2;\n};",
"struct uninit_s {\n int f1;\n int f2;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 149
| 149
|
uninit_024
|
pulse/uninit.c
|
nested_struct_good
|
nested_struct
|
void nested_struct() {
struct uninit_nested x;
x.g1.f1 = 42;
read_g1_f1(&x);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_nested {\n struct uninit_s g1;\n int g2;\n};",
"struct uninit_s {\n int f1;\n int f2;\n};",
"void read_g1_f1(struct uninit_nested* x) { int y = x->g1.f1; }\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 151
| 155
|
uninit_025
|
pulse/uninit.c
|
nested_struct_bad
|
nested_struct
|
void nested_struct() {
struct uninit_nested x;
x.g1.f2 = 42;
read_g1_f1(&x);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_nested {\n struct uninit_s g1;\n int g2;\n};",
"struct uninit_s {\n int f1;\n int f2;\n};",
"void read_g1_f1(struct uninit_nested* x) { int y = x->g1.f1; }\n"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
3
] |
[
160
] |
[
"ERROR"
] |
[
"struct field address `g1.f1` created,when calling `read_g1_f1` here,parameter `x` of read_g1_f1,read to uninitialized value occurs here"
] |
uninitialized_value
| true
| 157
| 161
|
uninit_026
|
pulse/uninit.c
|
init_ptr_zero
|
init_ptr_zero
|
void init_ptr_zero(int* ptr, int i) {
if (i != 0) {
*ptr = 42;
} else {
*(ptr + i) = 42;
}
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 163
| 169
|
uninit_027
|
pulse/uninit.c
|
call_init_ptr_zero_good
|
call_init_ptr_zero
|
void call_init_ptr_zero() {
int x;
init_ptr_zero(&x, 0);
int y = x;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"void init_ptr_zero(int* ptr, int i) {\n if (i != 0) {\n *ptr = 42;\n } else {\n *(ptr + i) = 42;\n }\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 171
| 175
|
uninit_028
|
pulse/uninit.c
|
uninit_if_zero_bad
|
uninit_if_zero
|
int uninit_if_zero(int a) {
int x;
if (a == 0) {
int y = x + 1;
int z = 4;
return z;
}
return 10;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | true
|
[
"PULSE_UNINITIALIZED_VALUE"
] |
[
3
] |
[
180
] |
[
"ERROR"
] |
[
"variable `x` declared here,read to uninitialized value occurs here"
] |
uninitialized_value
| false
| 177
| 185
|
uninit_029
|
pulse/uninit.c
|
uninit_interproc_manifest_bad
|
uninit_interproc_manifest
|
void uninit_interproc_manifest() {
int x = uninit_if_zero_bad(0);
if (x == 4) {
int* p = NULL;
*p = 42; // NPE to test that uninit didn't terminate the symbolic execution
}
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"int uninit_if_zero_bad(int a) {\n int x;\n if (a == 0) {\n int y = x + 1;\n int z = 4;\n return z;\n }\n return 10;\n}\n"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
4
] |
[
191
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| true
| 187
| 193
|
uninit_030
|
pulse/uninit.c
|
check_range
|
check_range
|
void check_range(int range_var_valid, int* range_var) {
if (range_var_valid) {
*range_var = *range_var + 1;
}
assert(range_var_valid >= 0 && range_var_valid <= 1);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 197
| 203
|
uninit_031
|
pulse/uninit.c
|
check_range_wrapper
|
check_range_wrapper
|
void check_range_wrapper(int range_var_valid, int* range_var) {
check_range(range_var_valid, range_var);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"void check_range(int range_var_valid, int* range_var) {\n if (range_var_valid) {\n *range_var = *range_var + 1;\n }\n\n assert(range_var_valid >= 0 && range_var_valid <= 1);\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 205
| 207
|
uninit_032
|
pulse/uninit.c
|
uninit_var_not_read_interproc_ok
|
uninit_var_not_read_interproc
|
void uninit_var_not_read_interproc() {
int range_var_valid = 0;
int range_var;
check_range_wrapper(range_var_valid, &range_var);
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"void check_range_wrapper(int range_var_valid, int* range_var) {\n check_range(range_var_valid, range_var);\n}\n"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| true
| 209
| 213
|
uninit_033
|
pulse/uninit.c
|
call_init_by_conditionaql_exp_ok
|
call_init_by_conditionaql_exp
|
int call_init_by_conditionaql_exp(int b) {
struct uninit_s x = init_by_conditional_exp(b);
return x.f1;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct uninit_s {\n int f1;\n int f2;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 223
| 226
|
uninit_034
|
pulse/uninit.c
|
build_struct_during_var_init_ok
|
build_struct_during_var_init
|
int build_struct_during_var_init() {
struct my_pair p = twice(42);
return p.x + p.y;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct my_pair {\n int x;\n int y;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 250
| 253
|
uninit_035
|
pulse/uninit.c
|
memset_init_ok
|
memset_init
|
int memset_init() {
struct my_pair pair;
memset(&pair, '\0', sizeof(struct my_pair));
return pair.x + pair.y;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct my_pair {\n int x;\n int y;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 261
| 265
|
uninit_036
|
pulse/uninit.c
|
memset_wrapper_init_ok
|
memset_wrapper_init
|
int memset_wrapper_init() {
struct my_pair pair;
set_pair_to_zero(&pair);
return pair.x + pair.y;
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct my_pair {\n int x;\n int y;\n};"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 271
| 275
|
uninit_037
|
pulse/uninit.c
|
memset_wrapper_value_bad
|
memset_wrapper_value
|
void memset_wrapper_value(struct my_pair* pair) {
set_pair_to_zero(pair);
if (pair->x == 0 && pair->y == 0) {
int* p = NULL;
*p = 42;
}
}
|
[
"#include <assert.h>",
"#include <stdlib.h>",
"struct my_pair {\n int x;\n int y;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
4
] |
[
281
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 277
| 283
|
unsigned_values_001
|
pulse/unsigned_values.c
|
signed_int_bad
|
signed_int
|
void signed_int() {
int x = returnSigned();
if (x < 0) {
// reachable
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
5
] |
[
30
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 25
| 32
|
unsigned_values_002
|
pulse/unsigned_values.c
|
signed_int_ptr_bad
|
signed_int_ptr
|
void signed_int_ptr() {
int* x = returnSigned();
if (*x < 0) {
// reachable
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
5
] |
[
54
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 49
| 56
|
unsigned_values_003
|
pulse/unsigned_values.c
|
signed_field_bad
|
signed_field
|
void signed_field() {
struct foo* x = returnFoo();
if (x->signed_int < 0) {
// reachable
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>",
"struct foo {\n unsigned int unsigned_int;\n int signed_int;\n};"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
5
] |
[
81
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 76
| 83
|
unsigned_values_004
|
pulse/unsigned_values.c
|
signed_array_bad
|
signed_array
|
int signed_array() {
int* a = returnSignedArray();
if (a[0] < 0) {
// reachable
int* p = NULL;
*p = 42;
}
}
|
[
"#include <stdlib.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
5
] |
[
105
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 100
| 107
|
var_arg_001
|
pulse/var_arg.c
|
sum
|
sum
|
int sum(int n, ...) {
va_list args;
va_start(args, n);
int sum = 0;
for (int i = 0; i < n; i++) {
sum += va_arg(args, int);
}
va_end(args);
return sum;
}
|
[
"#include <stdlib.h>",
"#include <stdarg.h>"
] | false
|
[] |
[] |
[] |
[] |
[] |
safe
| false
| 11
| 20
|
var_arg_002
|
pulse/var_arg.c
|
sum_one_then_npe_bad
|
sum_one_then_npe
|
void sum_one_then_npe() {
int one = sum(1, 1);
int* p = NULL;
*p = one;
}
|
[
"#include <stdlib.h>",
"#include <stdarg.h>",
"int sum(int n, ...) {\n va_list args;\n va_start(args, n);\n int sum = 0;\n for (int i = 0; i < n; i++) {\n sum += va_arg(args, int);\n }\n va_end(args);\n return sum;\n}\n"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
25
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| true
| 22
| 26
|
var_arg_003
|
pulse/var_arg.c
|
unknown_sum_one_then_npe_bad
|
unknown_sum_one_then_npe
|
void unknown_sum_one_then_npe() {
int one = unknown_sum(1, 1);
int* p = NULL;
*p = one;
}
|
[
"#include <stdlib.h>",
"#include <stdarg.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
58
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 55
| 59
|
var_arg_004
|
pulse/var_arg.c
|
unknown_sum_four_then_npe_bad
|
unknown_sum_four_then_npe
|
void unknown_sum_four_then_npe() {
int four = unknown_sum(4, 1, 1, 1, 1);
int* p = NULL;
*p = four;
}
|
[
"#include <stdlib.h>",
"#include <stdarg.h>"
] | true
|
[
"NULLPTR_DEREFERENCE"
] |
[
3
] |
[
64
] |
[
"ERROR"
] |
[
"is assigned to the null pointer,assigned,invalid access occurs here"
] |
nullptr_dereference
| false
| 61
| 65
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.