-
Notifications
You must be signed in to change notification settings - Fork 67
FIO38-C FIO47-C FIO42-C tests #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4d77a0a
Update WrongTypeFormatArguments.expected
mbaluda bac9f96
Rename WrongTypeFormatArguments.expected to WrongTypeFormatArguments.…
mbaluda eb78ff5
Create WrongTypeFormatArguments.expected.gcc
mbaluda 9fc7a9b
Create WrongTypeFormatArguments.expected
mbaluda 55d44f4
Fix compilation error for FIO38 test
mbaluda ea19cc2
Merge branch 'main' into FIO47-tests
mbaluda 0d0d7cc
FIO47 expected files
mbaluda 3cd710e
Merge branch 'main' into FIO47-tests
mbaluda 5d96eb5
Update test.c
mbaluda ec101ab
test.c false negatives
mbaluda 127b387
Merge branch 'main' into FIO47-tests
mbaluda 2d42b91
Fix compilation for FIO42-C
mbaluda ae38dc7
Merge branch 'main' into FIO47-tests
mbaluda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| test.c:10:20:10:26 | * ... | A FILE object is being copied. | | ||
| test.c:17:21:17:30 | * ... | A FILE object is being copied. | | ||
| test.c:23:21:23:31 | * ... | A FILE object is being copied. | | ||
| test.c:29:15:29:21 | * ... | A FILE object is being copied. | | ||
| test.c:42:19:42:28 | * ... | A FILE object is being copied. | | ||
| test.c:11:20:11:26 | * ... | A FILE object is being copied. | | ||
| test.c:18:21:18:30 | * ... | A FILE object is being copied. | | ||
| test.c:24:21:24:31 | * ... | A FILE object is being copied. | | ||
| test.c:30:15:30:21 | * ... | A FILE object is being copied. | | ||
| test.c:43:19:43:28 | * ... | A FILE object is being copied. | |
5 changes: 5 additions & 0 deletions
5
c/cert/test/rules/FIO38-C/DoNotCopyAFileObject.expected.clang
This file contains hidden or 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,5 @@ | ||
| test.c:4:20:4:26 | * ... | A FILE object is being copied. | | ||
| test.c:11:21:11:30 | * ... | A FILE object is being copied. | | ||
| test.c:17:21:17:31 | * ... | A FILE object is being copied. | | ||
| test.c:23:15:23:21 | * ... | A FILE object is being copied. | | ||
| test.c:36:19:36:28 | * ... | A FILE object is being copied. | |
This file contains hidden or 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,5 @@ | ||
| test.c:4:20:4:26 | * ... | A FILE object is being copied. | | ||
| test.c:11:21:11:30 | * ... | A FILE object is being copied. | | ||
| test.c:17:21:17:31 | * ... | A FILE object is being copied. | | ||
| test.c:23:15:23:21 | * ... | A FILE object is being copied. | | ||
| test.c:36:19:36:28 | * ... | A FILE object is being copied. | |
This file contains hidden or 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 hidden or 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,43 @@ | ||
#include <stdio.h> | ||
|
||
int f1(void) { | ||
FILE my_stdout = *stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", &my_stdout); | ||
} | ||
|
||
int f2(void) { | ||
FILE *my_stdout; | ||
my_stdout = stdout; // COMPLIANT | ||
FILE my_stdout2 = *my_stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", my_stdout); | ||
} | ||
int f2b(void) { | ||
FILE *const *my_stdout; | ||
my_stdout = &stdout; // COMPLIANT | ||
FILE my_stdout2 = **my_stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", *my_stdout); | ||
} | ||
|
||
int f3(void) { | ||
FILE my_stdout; | ||
my_stdout = *stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", &my_stdout); | ||
} | ||
|
||
int f4(void) { | ||
FILE *my_stdout; | ||
my_stdout = fopen("file.txt", "w"); // COMPLIANT | ||
return fputs("Hello, World!\n", my_stdout); | ||
} | ||
|
||
int f5helper(FILE my_stdout) { return fputs("Hello, World!\n", &my_stdout); } | ||
int f5(void) { | ||
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT | ||
return f5helper(*my_stdout); // NON_COMPLIANT | ||
} | ||
|
||
int f6helper(FILE *my_stdout) { return fputs("Hello, World!\n", my_stdout); } | ||
int f6(void) { | ||
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT | ||
return f6helper(my_stdout); // COMPLIANT | ||
} |
This file contains hidden or 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,43 @@ | ||
#include <stdio.h> | ||
|
||
int f1(void) { | ||
FILE my_stdout = *stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", &my_stdout); | ||
} | ||
|
||
int f2(void) { | ||
FILE *my_stdout; | ||
my_stdout = stdout; // COMPLIANT | ||
FILE my_stdout2 = *my_stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", my_stdout); | ||
} | ||
int f2b(void) { | ||
FILE *const *my_stdout; | ||
my_stdout = &stdout; // COMPLIANT | ||
FILE my_stdout2 = **my_stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", *my_stdout); | ||
} | ||
|
||
int f3(void) { | ||
FILE my_stdout; | ||
my_stdout = *stdout; // NON_COMPLIANT | ||
return fputs("Hello, World!\n", &my_stdout); | ||
} | ||
|
||
int f4(void) { | ||
FILE *my_stdout; | ||
my_stdout = fopen("file.txt", "w"); // COMPLIANT | ||
return fputs("Hello, World!\n", my_stdout); | ||
} | ||
|
||
int f5helper(FILE my_stdout) { return fputs("Hello, World!\n", &my_stdout); } | ||
int f5(void) { | ||
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT | ||
return f5helper(*my_stdout); // NON_COMPLIANT | ||
} | ||
|
||
int f6helper(FILE *my_stdout) { return fputs("Hello, World!\n", my_stdout); } | ||
int f6(void) { | ||
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT | ||
return f6helper(my_stdout); // COMPLIANT | ||
} |
This file contains hidden or 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
90 changes: 90 additions & 0 deletions
90
c/cert/test/rules/FIO47-C/WrongTypeFormatArguments.expected.clang
This file contains hidden or 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,90 @@ | ||
| test.c:376:17:376:30 | v_intmax_t_ptr | This argument should be of type 'int *' but is of type 'long *' | | ||
| test.c:378:17:378:28 | v_size_t_ptr | This argument should be of type 'int *' but is of type 'unsigned long *' | | ||
| test.c:380:17:380:31 | v_ptrdiff_t_ptr | This argument should be of type 'int *' but is of type 'long *' | | ||
| test.c:417:17:417:26 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:421:18:421:27 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:425:16:425:25 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:426:17:426:26 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:427:18:427:27 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:428:17:428:26 | v_char_ptr | This argument should be of type 'long' but is of type 'char *' | | ||
| test.c:429:18:429:27 | v_char_ptr | This argument should be of type 'long long' but is of type 'char *' | | ||
| test.c:430:17:430:26 | v_char_ptr | This argument should be of type 'intmax_t' but is of type 'char *' | | ||
| test.c:432:17:432:26 | v_char_ptr | This argument should be of type 'ptrdiff_t' but is of type 'char *' | | ||
| test.c:434:16:434:25 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:435:17:435:26 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:436:18:436:27 | v_char_ptr | This argument should be of type 'int' but is of type 'char *' | | ||
| test.c:437:17:437:26 | v_char_ptr | This argument should be of type 'long' but is of type 'char *' | | ||
| test.c:438:18:438:27 | v_char_ptr | This argument should be of type 'long long' but is of type 'char *' | | ||
| test.c:439:17:439:26 | v_char_ptr | This argument should be of type 'intmax_t' but is of type 'char *' | | ||
| test.c:441:17:441:26 | v_char_ptr | This argument should be of type 'ptrdiff_t' but is of type 'char *' | | ||
| test.c:443:16:443:25 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:444:17:444:26 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:445:18:445:27 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:446:17:446:26 | v_char_ptr | This argument should be of type 'unsigned long' but is of type 'char *' | | ||
| test.c:447:18:447:27 | v_char_ptr | This argument should be of type 'unsigned long long' but is of type 'char *' | | ||
| test.c:450:17:450:26 | v_char_ptr | This argument should be of type 'size_t' but is of type 'char *' | | ||
| test.c:454:16:454:25 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:455:17:455:26 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:456:18:456:27 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:457:17:457:26 | v_char_ptr | This argument should be of type 'unsigned long' but is of type 'char *' | | ||
| test.c:458:18:458:27 | v_char_ptr | This argument should be of type 'unsigned long long' but is of type 'char *' | | ||
| test.c:461:17:461:26 | v_char_ptr | This argument should be of type 'size_t' but is of type 'char *' | | ||
| test.c:465:16:465:25 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:466:17:466:26 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:467:18:467:27 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:468:17:468:26 | v_char_ptr | This argument should be of type 'unsigned long' but is of type 'char *' | | ||
| test.c:469:18:469:27 | v_char_ptr | This argument should be of type 'unsigned long long' but is of type 'char *' | | ||
| test.c:472:17:472:26 | v_char_ptr | This argument should be of type 'size_t' but is of type 'char *' | | ||
| test.c:476:16:476:25 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:477:17:477:26 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:478:18:478:27 | v_char_ptr | This argument should be of type 'unsigned int' but is of type 'char *' | | ||
| test.c:479:17:479:26 | v_char_ptr | This argument should be of type 'unsigned long' but is of type 'char *' | | ||
| test.c:480:18:480:27 | v_char_ptr | This argument should be of type 'unsigned long long' but is of type 'char *' | | ||
| test.c:483:17:483:26 | v_char_ptr | This argument should be of type 'size_t' but is of type 'char *' | | ||
| test.c:487:16:487:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:488:17:488:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:489:18:489:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:490:17:490:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:492:16:492:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:493:17:493:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:494:18:494:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:495:17:495:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:497:16:497:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:498:17:498:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:499:18:499:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:500:17:500:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:502:16:502:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:503:17:503:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:504:18:504:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:505:17:505:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:507:16:507:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:508:17:508:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:509:18:509:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:510:17:510:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:512:16:512:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:513:17:513:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:514:18:514:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:515:17:515:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:517:16:517:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:518:17:518:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:519:18:519:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:520:17:520:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:522:16:522:25 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:523:17:523:26 | v_char_ptr | This argument should be of type 'double' but is of type 'char *' | | ||
| test.c:524:18:524:27 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:525:17:525:26 | v_char_ptr | This argument should be of type 'long double' but is of type 'char *' | | ||
| test.c:527:16:527:25 | v_char_ptr | This argument should be of type 'char' but is of type 'char *' | | ||
| test.c:528:17:528:26 | v_char_ptr | This argument should be of type 'wchar_t' but is of type 'char *' | | ||
| test.c:530:16:530:20 | v_int | This argument should be of type 'char *' but is of type 'int' | | ||
| test.c:531:17:531:21 | v_int | This argument should be of type 'wchar_t *' but is of type 'int' | | ||
| test.c:533:16:533:20 | v_int | This argument should be of type 'void *' but is of type 'int' | | ||
| test.c:535:16:535:20 | v_int | This argument should be of type 'int *' but is of type 'int' | | ||
| test.c:536:17:536:21 | v_int | This argument should be of type 'short *' but is of type 'int' | | ||
| test.c:537:18:537:22 | v_int | This argument should be of type 'char *' but is of type 'int' | | ||
| test.c:538:17:538:21 | v_int | This argument should be of type 'long *' but is of type 'int' | | ||
| test.c:539:18:539:22 | v_int | This argument should be of type 'long long *' but is of type 'int' | | ||
| test.c:540:17:540:21 | v_int | This argument should be of type 'int *' but is of type 'int' | | ||
| test.c:541:17:541:21 | v_int | This argument should be of type 'int *' but is of type 'int' | | ||
| test.c:542:17:542:21 | v_int | This argument should be of type 'int *' but is of type 'int' | | ||
| test.c:544:16:544:25 | v_char_ptr | This argument should be of type 'wchar_t' but is of type 'char *' | | ||
| test.c:546:16:546:20 | v_int | This argument should be of type 'wchar_t *' but is of type 'int' | |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.