Reviewed By: jeremydubreil Differential Revision: D5485475 fbshipit-source-id: 424a88amaster
parent
a386ef5e83
commit
c9a2dcf7b1
@ -1,3 +1,7 @@
|
||||
codetoanalyze/c/biabduction/abduce.c, FN_set_ptr_param_array_get_null_bad, 3, PRECONDITION_NOT_MET, [start of procedure FN_set_ptr_param_array_get_null_bad()]
|
||||
codetoanalyze/c/biabduction/example.c, bar, 2, DIVIDE_BY_ZERO, [start of procedure bar()]
|
||||
codetoanalyze/c/biabduction/example.c, foo, 2, NULL_DEREFERENCE, [start of procedure foo()]
|
||||
codetoanalyze/c/biabduction/example.c, global_addr_alias_bad, 3, NULL_DEREFERENCE, [start of procedure global_addr_alias_bad(),Condition is true]
|
||||
codetoanalyze/c/biabduction/example.c, local_addr_noalias_bad, 4, NULL_DEREFERENCE, [start of procedure local_addr_noalias_bad(),Condition is true]
|
||||
codetoanalyze/c/biabduction/shift.c, return_null_deref1_bad, 2, NULL_DEREFERENCE, [start of procedure return_null_deref1_bad(),start of procedure return_depends_on_lshift(),Condition is true,return from a call to return_depends_on_lshift]
|
||||
codetoanalyze/c/biabduction/shift.c, return_null_deref2_bad, 2, NULL_DEREFERENCE, [start of procedure return_null_deref2_bad(),start of procedure return_depends_on_rshift(),Condition is true,return from a call to return_depends_on_rshift]
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
int* return_depends_on_lshift(int x, int* p) {
|
||||
if (x < (1 << 7))
|
||||
return 0;
|
||||
else
|
||||
return p;
|
||||
}
|
||||
|
||||
int return_nonnull_deref1_ok() {
|
||||
int y = 0;
|
||||
return *return_depends_on_lshift(1000, &y);
|
||||
}
|
||||
|
||||
int return_null_deref1_bad() {
|
||||
int y = 0;
|
||||
return *return_depends_on_lshift(0, &y);
|
||||
}
|
||||
|
||||
int* return_depends_on_rshift(int x, int* p) {
|
||||
if (x < (4 >> 2))
|
||||
return 0;
|
||||
else
|
||||
return p;
|
||||
}
|
||||
|
||||
int return_nonnull_deref2_ok() {
|
||||
int y = 0;
|
||||
return *return_depends_on_rshift(2, &y);
|
||||
}
|
||||
|
||||
int return_null_deref2_bad() {
|
||||
int y = 0;
|
||||
return *return_depends_on_rshift(0, &y);
|
||||
}
|
Loading…
Reference in new issue