add the example from the Eclipser paper
This commit is contained in:
parent
cd116c0ad2
commit
37d28b5c29
@ -112,6 +112,16 @@ if (BUILD_LIBFUZZER)
|
|||||||
set_target_properties(Runlen_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER")
|
set_target_properties(Runlen_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_executable(FromEclipser FromEclipser.cpp)
|
||||||
|
target_link_libraries(FromEclipser deepstate)
|
||||||
|
|
||||||
|
if (BUILD_LIBFUZZER)
|
||||||
|
add_executable(FromEclipser_LF FromEclipser.cpp)
|
||||||
|
target_link_libraries(FromEclipser_LF deepstate_LF)
|
||||||
|
target_link_libraries (FromEclipser_LF "-fsanitize=fuzzer,undefined")
|
||||||
|
set_target_properties(FromEclipser_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT APPLE)
|
if (NOT APPLE)
|
||||||
add_executable(Squares Squares.c)
|
add_executable(Squares Squares.c)
|
||||||
target_link_libraries(Squares deepstate)
|
target_link_libraries(Squares deepstate)
|
||||||
|
|||||||
19
examples/FromEclipser.cpp
Normal file
19
examples/FromEclipser.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <deepstate/DeepState.hpp>
|
||||||
|
|
||||||
|
using namespace deepstate;
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
int vulnfunc(int32_t intInput, char * strInput) {
|
||||||
|
if (2 * intInput + 1 == 31337)
|
||||||
|
if (strcmp(strInput, "Bad!") == 0)
|
||||||
|
assert(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(FromEclipser, CrashIt) {
|
||||||
|
char *buf = (char*)DeepState_Malloc(9);
|
||||||
|
buf[8] = 0;
|
||||||
|
vulnfunc(*((int32_t*) &buf[0]), &buf[4]);
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user