Reviewed By: da319 Differential Revision: D10250227 fbshipit-source-id: c72e08924master
parent
d8ecfbfc4b
commit
81f31068e2
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
int array_good1_FP() {
|
||||
int a[10];
|
||||
for (int i = 0; i < 10; i++) {
|
||||
a[i] = 0;
|
||||
}
|
||||
return a[2];
|
||||
}
|
||||
|
||||
int array_bad() {
|
||||
int a[10];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
a[i] = 0;
|
||||
}
|
||||
return a[9];
|
||||
}
|
||||
|
||||
int nondet();
|
||||
|
||||
int array_good2_FP() {
|
||||
int* a[10];
|
||||
int i = 0;
|
||||
while (i < 10) {
|
||||
if (nondet()) {
|
||||
a[i] = 0;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return a[2];
|
||||
}
|
||||
|
||||
int array_good3_FP(int m) {
|
||||
int* a[1000];
|
||||
int i = 0;
|
||||
while (i < 1000 && i < m) {
|
||||
if (nondet()) {
|
||||
a[i] = 0;
|
||||
m--;
|
||||
}
|
||||
}
|
||||
return i > 0 ? a[i - 1] : 42;
|
||||
}
|
||||
|
||||
void mayinit_vpp(const void**);
|
||||
void use_vp(void*);
|
||||
|
||||
void* call_to_mayinit_and_return_good_FP() {
|
||||
void* obj[10];
|
||||
mayinit_vpp((const void**)obj);
|
||||
return obj[0];
|
||||
}
|
||||
|
||||
void call_to_mayinit_and_call_use_good() {
|
||||
void* obj[10];
|
||||
mayinit_vpp((const void**)obj);
|
||||
use_vp(obj[0]);
|
||||
}
|
@ -1 +1,7 @@
|
||||
codetoanalyze/c/uninit/arrays.c, array_bad, 5, UNINITIALIZED_VALUE, no_bucket, ERROR, []
|
||||
codetoanalyze/c/uninit/arrays.c, array_good1_FP, 5, UNINITIALIZED_VALUE, no_bucket, ERROR, []
|
||||
codetoanalyze/c/uninit/arrays.c, array_good2_FP, 9, UNINITIALIZED_VALUE, no_bucket, ERROR, []
|
||||
codetoanalyze/c/uninit/arrays.c, array_good3_FP, 9, UNINITIALIZED_VALUE, no_bucket, ERROR, []
|
||||
codetoanalyze/c/uninit/arrays.c, call_to_mayinit_and_return_good_FP, 3, UNINITIALIZED_VALUE, no_bucket, ERROR, []
|
||||
codetoanalyze/c/uninit/uninit.c, dereference_bad, 2, UNINITIALIZED_VALUE, no_bucket, ERROR, []
|
||||
codetoanalyze/c/uninit/uninit.c, self_assign_bad, 2, UNINITIALIZED_VALUE, no_bucket, ERROR, []
|
||||
|
Loading…
Reference in new issue