gonzus / olc

A C implementation of Google's Open Location Code
MIT License
10 stars 1 forks source link

fuzz with afl? #1

Open dgryski opened 6 years ago

dgryski commented 6 years ago

Were you planning on writing some code to fuzz the decoder with http://lcamtuf.coredump.cx/afl/ ?

gonzus commented 6 years ago

Not really "planned" as such... :-)

On Thu, Mar 22, 2018 at 8:55 PM, Damian Gryski notifications@github.com wrote:

Were you planning on writing some code to fuzz the decoder with http://lcamtuf.coredump.cx/afl/ ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gonzus/olc/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMuon53u5dxe7D88uEBoHkPLg7O9acGks5thAGYgaJpZM4S3sem .

-- -- Gonzalo Diethelm

dgryski commented 6 years ago

Here's one for libfuzzer that ships with clang:

#include <stdint.h>
#include <stddef.h>
#include "olc.h"

int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
  OLC_CodeArea area;
  OLC_Decode((const char*)Data, &area);
  return 0;
}

Then

$ clang -g -fsanitize=fuzzer,address fuzz.c olc.c
$ ./a.out

and wait..

gonzus commented 6 years ago

This is awesome, thanks for pointing it out to me. I have modified the public API to allow for fixing all the bugs discovered by fuzzing; fuck it, this is a real improvement. Thanks!