-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from bjjwwang/master
add NULL cases
- Loading branch information
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "stdbool.h" | ||
#include <stdlib.h> | ||
extern void svf_assert(bool); | ||
|
||
int main() { | ||
int *ptr = NULL; | ||
svf_assert(ptr == NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "stdbool.h" | ||
#include <stdlib.h> | ||
extern void svf_assert(bool); | ||
|
||
int main() { | ||
int value = 10; | ||
int *ptr = &value; | ||
svf_assert(ptr != NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "stdbool.h" | ||
#include <stdlib.h> | ||
extern void svf_assert(bool); | ||
|
||
int main() { | ||
int *ptr = NULL; | ||
bool isNullDereference = false; | ||
|
||
if (ptr == NULL) { | ||
isNullDereference = true; | ||
} | ||
|
||
svf_assert(isNullDereference); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "stdbool.h" | ||
#include <stdlib.h> | ||
extern void svf_assert(bool); | ||
|
||
int main() { | ||
int *a[3][3] = {NULL}; | ||
|
||
bool isNull = (a[0][0] == NULL); | ||
svf_assert(isNull); | ||
|
||
return 0; | ||
} |