1# Fuzzer for libstagefright_g711dec decoder 2 3## Plugin Design Considerations 4The fuzzer plugin for G711 is designed based on the understanding of the 5codec and tries to achieve the following: 6 7##### Maximize code coverage 8G711 supports two types of decoding: 91. DecodeALaw 102. DecodeMLaw 11 12These two decoder API's are fuzzed separately using g711alaw_dec_fuzzer and 13g711mlaw_dec_fuzzer respectively. 14 15##### Maximize utilization of input data 16The plugin feeds the entire input data to the codec as expected by decoder API. 17 18## Build 19 20This describes steps to build g711alaw_dec_fuzzer and g711mlaw_dec_fuzzer binary. 21 22### Android 23 24#### Steps to build 25Build the fuzzer 26``` 27 $ mm -j$(nproc) g711alaw_dec_fuzzer 28 $ mm -j$(nproc) g711mlaw_dec_fuzzer 29``` 30 31#### Steps to run 32Create a directory CORPUS_DIR and copy some g711 files to that folder 33Push this directory to device. 34 35To run on device 36``` 37 $ adb sync data 38 $ adb shell /data/fuzz/arm64/g711alaw_dec_fuzzer/g711alaw_dec_fuzzer CORPUS_DIR 39 $ adb shell /data/fuzz/arm64/g711mlaw_dec_fuzzer/g711mlaw_dec_fuzzer CORPUS_DIR 40``` 41To run on host 42``` 43 $ $ANDROID_HOST_OUT/fuzz/x86_64/g711alaw_dec_fuzzer/g711alaw_dec_fuzzer CORPUS_DIR 44 $ $ANDROID_HOST_OUT/fuzz/x86_64/g711mlaw_dec_fuzzer/g711mlaw_dec_fuzzer CORPUS_DIR 45``` 46 47## References: 48 * http://llvm.org/docs/LibFuzzer.html 49 * https://github.com/google/oss-fuzz 50