mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-29 13:30:34 +01:00
35 lines
497 B
C
35 lines
497 B
C
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#if !defined LIB || !defined FUNC
|
|
#error
|
|
#endif
|
|
|
|
typedef int (*FuzzFunc)(const char *Data, size_t Size);
|
|
|
|
void *handle = NULL;
|
|
FuzzFunc f = NULL;
|
|
|
|
int LLVMFuzzerTestOneInput( const char *Data, size_t Size )
|
|
{
|
|
if( !handle )
|
|
handle = dlopen( LIB, RTLD_NOW );
|
|
|
|
if( handle )
|
|
{
|
|
if( !f )
|
|
f = dlsym( handle, FUNC );
|
|
|
|
if( f )
|
|
{
|
|
return f( Data, Size );
|
|
}
|
|
}
|
|
|
|
fprintf( stderr, "Fail: %s\n", dlerror() );
|
|
|
|
abort();
|
|
return 0;
|
|
}
|