• Home
Name Date Size #Lines LOC

..--

Android.bpD03-May-2024743 3230

README.mdD03-May-20241.5 KiB7059

mpeg2_dec_fuzzer.cppD03-May-202413.7 KiB457349

mpeg2_dec_fuzzer.dictD03-May-202448 32

ossfuzz.shD03-May-20241.3 KiB4522

README.md

1# Fuzzer for libmpeg2 decoder
2
3This describes steps to build mpeg2_dec_fuzzer binary.
4
5## Linux x86/x64
6
7###  Requirements
8- cmake (3.5 or above)
9- make
10- clang (6.0 or above)
11  needs to support -fsanitize=fuzzer, -fsanitize=fuzzer-no-link
12
13### Steps to build
14Clone libmpeg2 repository
15```
16$ git clone https://android.googlesource.com/platform/external/libmpeg2
17```
18Create a directory inside libmpeg2 and change directory
19```
20 $ cd libmpeg2
21 $ mkdir build
22 $ cd build
23```
24Build libmpeg2 using cmake
25```
26 $ CC=clang CXX=clang++ cmake ../ \
27   -DSANITIZE=fuzzer-no-link,address,signed-integer-overflow
28 $ make
29 ```
30Build the fuzzer
31```
32 $ clang++ -std=c++11 -fsanitize=fuzzer,address -I.  -I../  -I../common \
33   -I../decoder -Wl,--start-group ../fuzzer/mpeg2_dec_fuzzer.cpp \
34   -o ./mpeg2_dec_fuzzer ./libmpeg2dec.a -Wl,--end-group
35```
36
37### Steps to run
38Create a directory CORPUS_DIR and copy some elementary mpeg2 files to that folder
39To run the fuzzer
40```
41$ ./mpeg2_dec_fuzzer CORPUS_DIR
42```
43
44## Android
45
46### Steps to build
47Build the fuzzer
48```
49  $ SANITIZE_TARGET=address SANITIZE_HOST=address mmma -j$(nproc) \
50    external/libmpeg2/fuzzer
51```
52
53### Steps to run
54Create a directory CORPUS_DIR and copy some elementary mpeg2 files to that folder
55Push this directory to device.
56
57To run on device
58```
59  $ adb sync data
60  $ adb shell /data/fuzz/mpeg2_dec_fuzzer CORPUS_DIR
61```
62To run on host
63```
64  $ $ANDROID_HOST_OUT/fuzz/mpeg2_dec_fuzzer CORPUS_DIR
65```
66
67## References:
68 * http://llvm.org/docs/LibFuzzer.html
69 * https://github.com/google/oss-fuzz
70