forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
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 diffblue#5663 from tautschnig/string-abstraction
String abstraction fixes
- Loading branch information
Showing
68 changed files
with
414 additions
and
305 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
regression/cbmc-from-CVS/String_Abstraction11/anon-retval.c
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
regression/cbmc-library/string-abstraction/test-c-with-string-abstraction.desc
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include <assert.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
int main() | ||
{ | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FUTURE | ||
CORE | ||
main.c | ||
--string-abstraction | ||
^EXIT=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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FUTURE | ||
CORE | ||
main.c | ||
--string-abstraction | ||
^EXIT=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,17 @@ | ||
#include <string.h> | ||
|
||
int main() | ||
{ | ||
char a[100], b[100], *p; | ||
|
||
strcpy(a, "asd"); | ||
assert(strlen(a) == 3); | ||
|
||
a[2] = 0; | ||
assert(strlen(a) == 2); | ||
|
||
p = strcpy(b, a); | ||
assert(p == b); | ||
assert(strlen(b) == 2); | ||
assert(strlen(p) == 2); | ||
} |
File renamed without changes.
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
4 changes: 3 additions & 1 deletion
4
...mc-from-CVS/String_Abstraction9/test.desc → ...ssion/cbmc/String_Abstraction10/test.desc
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
CORE | ||
KNOWNBUG | ||
main.c | ||
--string-abstraction --pointer-check --bounds-check | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
Multi-dimensional arrays are not yet handled properly. |
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,16 @@ | ||
void *malloc(unsigned); | ||
|
||
char *foo() | ||
{ | ||
char *a; | ||
a = malloc(2); | ||
a[1] = 0; | ||
__CPROVER_is_zero_string(a) = 1; | ||
return a; | ||
} | ||
|
||
int main() | ||
{ | ||
__CPROVER_assert( | ||
__CPROVER_is_zero_string(foo()), "CBMC failed to track return value"); | ||
} |
File renamed without changes.
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 @@ | ||
int main(int argc, char *argv[]) | ||
{ | ||
char dest[10]; | ||
|
||
__CPROVER_assert( | ||
__CPROVER_buffer_size(dest) == 10, "CBMC failed to track char array size"); | ||
dest[9] = '\0'; | ||
__CPROVER_assert( | ||
__CPROVER_is_zero_string(dest), "CBMC failed to track char array (2)"); | ||
|
||
return 0; | ||
} |
File renamed without changes.
13 changes: 7 additions & 6 deletions
13
...-from-CVS/String_Abstraction13/constant.c → ...sion/cbmc/String_Abstraction13/constant.c
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
File renamed without changes.
10 changes: 6 additions & 4 deletions
10
...S/String_Abstraction14/pass-in-implicit.c → ...c/String_Abstraction14/pass-in-implicit.c
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
File renamed without changes.
10 changes: 6 additions & 4 deletions
10
...c-from-CVS/String_Abstraction15/pass-in.c → ...ssion/cbmc/String_Abstraction15/pass-in.c
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
File renamed without changes.
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,16 @@ | ||
#include <string.h> | ||
|
||
void *malloc(__CPROVER_size_t); | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
char *name; | ||
|
||
name = malloc(10); | ||
__CPROVER_assume(__CPROVER_buffer_size(name) == 20); | ||
name = strcpy(name, "abcdefghi"); | ||
name = strcpy(name + 5 - 1, "xxxxx"); | ||
assert(__CPROVER_is_zero_string(name)); | ||
|
||
return 0; | ||
} |
File renamed without changes.
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
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,11 @@ | ||
CORE | ||
strcpy-no-decl.c | ||
--string-abstraction --validate-goto-model | ||
Condition: strlen type inconsistency | ||
^EXIT=(127|134)$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
While this test currently passes when omitting --validate-goto-model, we should | ||
expect a report of type inconsistencies as no forward declarations are present. |
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
File renamed without changes.
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,24 @@ | ||
void *malloc(unsigned); | ||
|
||
typedef struct str_struct | ||
{ | ||
int a; | ||
char *str; | ||
char *str2; | ||
} str_struct_t; | ||
|
||
str_struct_t *foo() | ||
{ | ||
str_struct_t retval; | ||
retval.str = malloc(2); | ||
__CPROVER_is_zero_string(retval.str) = 1; | ||
return &retval; | ||
} | ||
|
||
int main() | ||
{ | ||
str_struct_t *a; | ||
a = foo(); | ||
__CPROVER_assert( | ||
__CPROVER_is_zero_string(a->str), "CBMC failed to track struct"); | ||
} |
File renamed without changes.
Oops, something went wrong.