Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
fopen mode 1
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-gupta committed Jul 30, 2019
1 parent ff9089b commit 64928d4
Show file tree
Hide file tree
Showing 29 changed files with 4,197 additions and 6 deletions.
9 changes: 7 additions & 2 deletions replace.sh
Expand Up @@ -30,9 +30,14 @@ sed -i 's/internal//g' $replacement.ll
# find new names of functions, based on McSema's changes
functionToReplace=$(grep -o -m 1 sub_[^_]*_*$originalFunction $original.ll)
exitCode=$(echo $?)
if [ $exitCode = '1' ] # a stripped binary, where function name is the address
if [ $exitCode = '1' ] # replacing a library function
then
functionToReplace=$originalFunction
functionToReplace=$(grep -o -m 1 ext_[^_]*_*$originalFunction $original.ll)
exitCode2=$(echo $?)
if [ $exitCode2 = '1' ] # a stripped binary, where function name is the address
then
functionToReplace=$originalFunction
fi
fi
replacementFunction=$(grep -o -m 1 sub_[^_]*_*$newFunction $replacement.ll)
# recompile altered replacement .ll to bitcode
Expand Down
Binary file added tests/fopen/mode1/myfopen
Binary file not shown.
Binary file added tests/fopen/mode1/myfopen.bc
Binary file not shown.
10 changes: 10 additions & 0 deletions tests/fopen/mode1/myfopen.c
@@ -0,0 +1,10 @@
#include <stdio.h>

FILE *newfopen(const char *path, const char *mode) {
printf("Always failing fopen\n");
return NULL;
}

int main() {
return 0;
}
Binary file added tests/fopen/mode1/myfopen.cfg
Binary file not shown.
1,639 changes: 1,639 additions & 0 deletions tests/fopen/mode1/myfopen.ll

Large diffs are not rendered by default.

0 comments on commit 64928d4

Please sign in to comment.