root@4558d8a05c92:/android/examples/Sample# ls
jni libs obj seeds
root@4558d8a05c92:/android/examples/Sample# cd jni/
root@4558d8a05c92:/android/examples/Sample/jni# ls
Android.mk Application.mk Makefile boo.cpp lib
root@4558d8a05c92:/android/examples/Sample/jni# ls lib/
fuzz.cpp fuzz.h include
Last active
July 10, 2024 12:59
-
-
Save ant4g0nist/8d761d105f45033f3c704dfaea6e765a to your computer and use it in GitHub Desktop.
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
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_MODULE := libhwui | |
LOCAL_SRC_FILES := /android/rootfs/system/lib64/libhwui.so | |
include $(PREBUILT_SHARED_LIBRARY) | |
### build your lib ### | |
include $(CLEAR_VARS) | |
LOCAL_LDLIBS := -lhwui -L/android/rootfs/system/lib64/ | |
LOCAL_MODULE := libBooFuzz | |
LOCAL_SRC_FILES := lib/fuzz.cpp | |
include $(BUILD_SHARED_LIBRARY) | |
# ### build the main ### | |
include $(CLEAR_VARS) | |
LOCAL_LDLIBS := -llog -landroidicu -lz -lGLESv1_CM -lGLESOverlay -lEGL -lGLESv3 -lBooFuzz -L../libs/arm64-v8a/ -landroidicu -lhwui -L/android/rootfs/system/lib64/ -Wl,-rpath-link=/android/rootfs/system/lib64/ -Wl,--dynamic-linker=/android/rootfs/system/bin/linker64 | |
LOCAL_MODULE := boofuzz | |
LOCAL_SRC_FILES := boo.cpp | |
include $(BUILD_EXECUTABLE) |
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
APP_MODULES := libBooFuzz boofuzz | |
APP_ABI := arm64-v8a |
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
#include "lib/fuzz.h" | |
#include <stdio.h> | |
int main(int argc, char** argv) { | |
// libQemuFuzzerTestOneInput((const uint8_t*)&"voila", 10); | |
const uint8_t data = 0; | |
libQemuFuzzerTestOneInput(&data, 1); | |
} |
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
// lib/fuzz.cpp | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
#include "fuzz.h" | |
extern "C" int libQemuFuzzerTestOneInput(const uint8_t *Data, size_t Size) { | |
if (Size <5 && Size > 4096) | |
return 0; | |
if(Data[0] == 0x41) | |
{ | |
if(Data[1] == 0x42) | |
{ | |
if(Data[2] == 0x43) | |
{ | |
if(Data[4] == 0x44) | |
{ | |
if(Data[5] == 0x45) | |
{ | |
char * ptr = (char*) 0x61616161; | |
ptr[0]=0; | |
} | |
} | |
} | |
} | |
} | |
return 0; | |
} |
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
build: | |
ndk-build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment