-
Notifications
You must be signed in to change notification settings - Fork 273
Taint for C #1518
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
Taint for C #1518
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <stdlib.h> | ||
|
||
void my_f(void *) { } | ||
void my_h(void *) { } | ||
void *my_g(void) { return malloc(1); } | ||
|
||
void my_function() | ||
{ | ||
void *o; | ||
|
||
my_f(o); // T1 source | ||
my_h(o); // T1,T2 sink | ||
|
||
o=my_g(); // T2 source | ||
my_h(o); // T1,T2 sink | ||
} |
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
regression/goto-analyzer-taint-ansi-c/taint-basic1/taint.json
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,6 @@ | ||
[ | ||
{ "id": "my_f", "kind": "source", "where": "parameter1", "taint": "T1", "function": "my_f" }, | ||
{ "id": "my_g", "kind": "source", "where": "return_value", "taint": "T2", "function": "my_g" }, | ||
{ "id": "my_h1", "kind": "sink", "where": "parameter1", "taint": "T1", "function": "my_h", "message": "There is a T1 flow" }, | ||
{ "id": "my_h2", "kind": "sink", "where": "parameter1", "taint": "T2", "function": "my_h", "message": "There is a T2 flow" } | ||
] |
10 changes: 10 additions & 0 deletions
10
regression/goto-analyzer-taint-ansi-c/taint-basic1/test.desc
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,10 @@ | ||
CORE | ||
main.o | ||
--taint taint.json | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^file main.c line 12( function .*)?: There is a T1 flow \(taint rule my_h1\)$ | ||
^file main.c line 15( function .*)?: There is a T2 flow \(taint rule my_h2\)$ | ||
-- | ||
^file main.c line 12( function .*)?: There is a T2 flow \(.*\)$ | ||
^file main.c line 15( function .*)?: There is a T1 flow \(.*\)$ |
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,13 @@ | ||
void my_f(void *) { } | ||
void my_h(void *) { } | ||
|
||
void my_function() | ||
{ | ||
void *o1; | ||
my_f(o1); // T1 source | ||
|
||
void *o2; | ||
o2=o1; | ||
|
||
my_h(o2); // T1 sink | ||
} |
Binary file not shown.
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,4 @@ | ||
[ | ||
{ "id": "my_f", "kind": "source", "where": "parameter1", "taint": "T1", "function": "my_f" }, | ||
{ "id": "my_h", "kind": "sink", "where": "parameter1", "taint": "T1", "function": "my_h", "message": "There is a T1 flow" } | ||
] |
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,7 @@ | ||
CORE | ||
main.o | ||
--taint taint.json | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^file main.c line 12( function .*)?: There is a T1 flow \(taint rule my_h\)$ | ||
-- |
24 changes: 24 additions & 0 deletions
24
regression/goto-analyzer-taint-ansi-c/taint-member1/main.c
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,24 @@ | ||
#include <stdlib.h> | ||
|
||
void my_f(void *) { } | ||
void my_h(void *) { } | ||
|
||
void my_function() | ||
{ | ||
struct some_struct | ||
{ | ||
void *data; | ||
} whatnot; | ||
|
||
my_f(whatnot.data); // T1 source | ||
my_h(whatnot.data); // T1 sink | ||
|
||
// via a copy | ||
void *o=whatnot.data; | ||
my_h(o); // T1 sink | ||
|
||
// copy entire struct | ||
struct some_struct whatelse; | ||
whatelse=whatnot; | ||
my_h(whatelse.data); // T1 sink | ||
} |
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
regression/goto-analyzer-taint-ansi-c/taint-member1/taint.json
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,4 @@ | ||
[ | ||
{ "id": "my_f", "kind": "source", "where": "parameter1", "taint": "T1", "function": "my_f" }, | ||
{ "id": "my_h", "kind": "sink", "where": "parameter1", "taint": "T1", "function": "my_h", "message": "There is a T1 flow" } | ||
] |
9 changes: 9 additions & 0 deletions
9
regression/goto-analyzer-taint-ansi-c/taint-member1/test.desc
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,9 @@ | ||
CORE | ||
main.o | ||
--taint taint.json | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^file main.c line 14( function .*)?: There is a T1 flow \(taint rule my_h\)$ | ||
^file main.c line 18( function .*)?: There is a T1 flow \(taint rule my_h\)$ | ||
^file main.c line 23( function .*)?: There is a T1 flow \(taint rule my_h\)$ | ||
-- |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add checks that there is no T1 in line 15 and no T2 in line 12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.