From e6c8ceed47f9acecdc15ddd3af4c486fe39c17a3 Mon Sep 17 00:00:00 2001 From: Waylon Cude Date: Wed, 23 Sep 2020 16:26:06 -0700 Subject: [PATCH 1/2] Add a null pointer dereference --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index d8a3900..911a552 100644 --- a/main.c +++ b/main.c @@ -4,6 +4,7 @@ static char text[] = "Hello Muse!"; int main() { char * printme = text; + printme = NULL; printf("%s\n",printme); return 0; } From 093d063f4faf48d749155b219d53165b82e0877a Mon Sep 17 00:00:00 2001 From: Waylon Cude Date: Fri, 25 Sep 2020 00:16:44 -0700 Subject: [PATCH 2/2] Break more things Infer doesn't see the null pointer dereference on calls to library functions --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index 911a552..99e2303 100644 --- a/main.c +++ b/main.c @@ -5,6 +5,10 @@ static char text[] = "Hello Muse!"; int main() { char * printme = text; printme = NULL; + printme[0] = 'X'; + printme[1] = 'X'; + printme[2] = 'X'; + printme[3] = '\0'; printf("%s\n",printme); return 0; }