diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-09 08:07:38 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-09 08:07:38 +0000 |
commit | 4f3dc698a1bbeea16155e51dfc7d0f69ff689598 (patch) | |
tree | fbcb706badb2dfb55b585650186a4dfe520f96b1 /test | |
parent | 2900ca37218a80c6e42b41c0076235276027f320 (diff) |
Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/array-struct.c | 2 | ||||
-rw-r--r-- | test/Analysis/misc-ps-region-store.m | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c index 18a6ed5074..1ab67874c6 100644 --- a/test/Analysis/array-struct.c +++ b/test/Analysis/array-struct.c @@ -153,7 +153,7 @@ struct s3 p[1]; // an ElementRegion of type 'char'. Then load a nonloc::SymbolVal from it and // assigns to 'a'. void f16(struct s3 *p) { - struct s3 a = *((struct s3*) ((char*) &p[0])); + struct s3 a = *((struct s3*) ((char*) &p[0])); // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption.}} } void inv(struct s1 *); diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index edea24224b..2c5180791e 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -286,7 +286,7 @@ struct WrappedStruct { unsigned z; }; int test_handle_array_wrapper() { struct ArrayWrapper x; test_handle_array_wrapper(&x); - struct WrappedStruct *p = (struct WrappedStruct*) x.y; + struct WrappedStruct *p = (struct WrappedStruct*) x.y; // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption.}} return p->z; // no-warning } |