Skip to content

Commit

Permalink
fix extapi.c and ExtAPI.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
bjjwwang committed Dec 13, 2023
1 parent 8fe3974 commit 1cbe205
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
52 changes: 26 additions & 26 deletions svf-llvm/lib/extapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,28 +555,28 @@ int XmbTextPropertyToTextList(void *a, void *b, char ***c, int *d)
return 0;
}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void llvm_memcpy_p0i8_p0i8_i64(char* dst, char* src, int sz, int flag){}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void llvm_memcpy_p0i8_p0i8_i32(char* dst, char* src, int sz, int flag){}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void llvm_memcpy(char* dst, char* src, int sz, int flag){}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void llvm_memmove(char* dst, char* src, int sz, int flag){}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void llvm_memmove_p0i8_p0i8_i64(char* dst, char* src, int sz, int flag){}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void llvm_memmove_p0i8_p0i8_i32(char* dst, char* src, int sz, int flag){}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void __memcpy_chk(char* dst, char* src, int sz, int flag){}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void *memmove(void *str1, const void *str2, unsigned long n)
{
return NULL;
Expand All @@ -591,19 +591,19 @@ void *memccpy( void * restrict dest, const void * restrict src, int c, unsigned
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
void __memmove_chk(char* dst, char* src, int sz){}

__attribute__((annotate("MEMSET"), annotate("BUF_CHECK:Arg0, Arg2")))
__attribute__((annotate("MEMSET")))
void llvm_memset(char* dst, char elem, int sz, int flag){}

__attribute__((annotate("MEMSET"), annotate("BUF_CHECK:Arg0, Arg2")))
__attribute__((annotate("MEMSET")))
void llvm_memset_p0i8_i32(char* dst, char elem, int sz, int flag){}

__attribute__((annotate("MEMSET"), annotate("BUF_CHECK:Arg0, Arg2")))
__attribute__((annotate("MEMSET")))
void llvm_memset_p0i8_i64(char* dst, char elem, int sz, int flag){}

__attribute__((annotate("MEMSET"), annotate("BUF_CHECK:Arg0, Arg2")))
__attribute__((annotate("MEMSET")))
char *__memset_chk(char * dest, int c, unsigned long destlen, int flag)
{
return NULL;
Expand All @@ -615,78 +615,78 @@ char *wmemset(wchar_t * dst, wchar_t elem, int sz, int flag) {
}


__attribute__((annotate("MEMCPY"), annotate("STRCPY")))
__attribute__((annotate("STRCPY")))
char * __strcpy_chk(char * dest, const char * src, unsigned long destlen)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
char *__strcat_chk(char * dest, const char * src, unsigned long destlen)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
wchar_t* __wcscat_chk(wchar_t * dest, const wchar_t * src)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCPY")))
__attribute__((annotate("STRCPY")))
char *stpcpy(char *restrict dst, const char *restrict src)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
char *strcat(char *dest, const char *src)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
char *wcscat(char *dest, const char *src)
{
return NULL;
}


__attribute__((annotate("MEMCPY"), annotate("STRCPY")))
__attribute__((annotate("STRCPY")))
char *strcpy(char *dest, const char *src)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
char *strncat(char *dest, const char *src, unsigned long n)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
wchar_t* wcsncat(wchar_t * dest, const wchar_t * src, int n) {
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
char *__strncat_chk(char *dest, const char *src, unsigned long n)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCAT")))
__attribute__((annotate("STRCAT")))
wchar_t* __wcsncat_chk(wchar_t * dest, const wchar_t * src, int n) {
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")))
__attribute__((annotate("MEMCPY")))
char *strncpy(char *dest, const char *src, unsigned long n)
{
return NULL;
}

__attribute__((annotate("MEMCPY"), annotate("STRCPY")))
__attribute__((annotate("STRCPY")))
char *wcscpy(wchar_t* dest, const wchar_t* src) {
return NULL;
}
Expand Down
7 changes: 4 additions & 3 deletions svf/lib/Util/ExtAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ bool ExtAPI::hasExtFuncAnnotation(const SVFFunction* fun, const std::string& fun
return false;
}

bool ExtAPI::is_memcpy(const SVFFunction *F)
{
return F && hasExtFuncAnnotation(F, "MEMCPY");
bool ExtAPI::is_memcpy(const SVFFunction *F){
return F &&
(hasExtFuncAnnotation(F, "MEMCPY") || hasExtFuncAnnotation(F, "STRCPY")
|| hasExtFuncAnnotation(F, "STRCAT"));
}

bool ExtAPI::is_memset(const SVFFunction *F)
Expand Down

0 comments on commit 1cbe205

Please sign in to comment.