Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
Android.bp | D | 03-May-2024 | 743 | 32 | 30 | |
README.md | D | 03-May-2024 | 1.5 KiB | 70 | 59 | |
mpeg2_dec_fuzzer.cpp | D | 03-May-2024 | 13.7 KiB | 457 | 349 | |
mpeg2_dec_fuzzer.dict | D | 03-May-2024 | 48 | 3 | 2 | |
ossfuzz.sh | D | 03-May-2024 | 1.3 KiB | 45 | 22 |
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