
* run qemu fuzzers (qemu_systemmode only for now) in self-hosted runners * Remove qemu-related fuzzers to general fuzzers * fix * Install dependencies before anything else * Do not use sudo * Install sudo * Revert "Install dependencies before anything else" This reverts commit 107addad5d9f68dec5a9af50831112cd72c28f4d. * added qemu specific prerequisites * add -y flag * Format with nightly * Do not use nightly only. Install fmt and clippy for stable as well. * Install qemu-img for qemu * fix qemu-img install * apt update * Changed timeout. * Fix qemu_systemmode test * fmt * clippy + decorrelate build and run for qemu_systemmode. * fix fuzzer * clippy * add sqlite3-dev to package prerequisites. * add arm-none-eabi-gcc * fix profile dir * fix condition. * Run less QEMU stuff faster --------- Co-authored-by: Toka <tokazerkje@outlook.com>
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
#ifdef TARGET_SYNC_EXIT
|
|
#include "libafl_qemu.h"
|
|
#endif
|
|
|
|
int __attribute__((noinline)) BREAKPOINT() {
|
|
for (;;) {}
|
|
}
|
|
|
|
int LLVMFuzzerTestOneInput(unsigned int *Data, unsigned int Size) {
|
|
#ifdef TARGET_SYNC_EXIT
|
|
LIBAFL_QEMU_START_PHYS((unsigned int)Data, Size);
|
|
#endif
|
|
if (Data[3] == 0) {
|
|
while (1) {}
|
|
} // cause a timeout
|
|
for (int i = 0; i < Size; i++) {
|
|
// if (Data[i] > 0xFFd0 && Data[i] < 0xFFFF) {return 1;} // cause qemu to
|
|
// crash
|
|
for (int j = i + 1; j < Size; j++) {
|
|
if (Data[j] == 0) { continue; }
|
|
if (Data[j] > Data[i]) {
|
|
int tmp = Data[i];
|
|
Data[i] = Data[j];
|
|
Data[j] = tmp;
|
|
if (Data[i] <= 100) { j--; }
|
|
}
|
|
}
|
|
}
|
|
#ifdef TARGET_SYNC_EXIT
|
|
LIBAFL_QEMU_END(LIBAFL_QEMU_END_OK);
|
|
#endif
|
|
return BREAKPOINT();
|
|
}
|
|
unsigned int FUZZ_INPUT[] = {
|
|
101, 201, 700, 230, 860, 234, 980, 200, 340, 678, 230, 134, 900,
|
|
236, 900, 123, 800, 123, 658, 607, 246, 804, 567, 568, 207, 407,
|
|
246, 678, 457, 892, 834, 456, 878, 246, 699, 854, 234, 844, 290,
|
|
125, 324, 560, 852, 928, 910, 790, 853, 345, 234, 586,
|
|
};
|
|
|
|
int main() {
|
|
LLVMFuzzerTestOneInput(FUZZ_INPUT, 50);
|
|
}
|