aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tyson Smith <tysmith@users.noreply.github.com>2019-01-25 12:39:10 -0800
committerGravatar jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2019-01-25 12:39:10 -0800
commit456eded09c7f24c5ee3f14fd2e358edc7de9064c (patch)
tree85560f47abf601f32ee2180c545af018a212c80f
parent7ef4eae22cca28c9afad28e1a7c52fbc0fd79923 (diff)
[openh264] Add to corpus and enable ASM for non-MSAN (#2113)
-rw-r--r--projects/openh264/Dockerfile2
-rwxr-xr-xprojects/openh264/build.sh12
-rw-r--r--projects/openh264/decoder_fuzzer.cpp4
3 files changed, 14 insertions, 4 deletions
diff --git a/projects/openh264/Dockerfile b/projects/openh264/Dockerfile
index eef2b15e..ff598fca 100644
--- a/projects/openh264/Dockerfile
+++ b/projects/openh264/Dockerfile
@@ -16,7 +16,7 @@
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER twsmith@mozilla.com
-RUN apt-get update && apt-get install -y libstdc++-5-dev
+RUN apt-get update && apt-get install -y libstdc++-5-dev nasm subversion
RUN git clone --depth 1 https://github.com/cisco/openh264.git openh264
WORKDIR openh264
COPY build.sh decoder_fuzzer.cpp $SRC/
diff --git a/projects/openh264/build.sh b/projects/openh264/build.sh
index 22b34ad2..cc011a10 100755
--- a/projects/openh264/build.sh
+++ b/projects/openh264/build.sh
@@ -16,8 +16,16 @@
################################################################################
# prepare corpus
-zip -q0r ${OUT}/decoder_fuzzer_seed_corpus.zip ./res/
+svn export https://github.com/mozillasecurity/fuzzdata.git/trunk/samples/h264 corpus/
+mv ./res/*.264 ./corpus/
+zip -q0r ${OUT}/decoder_fuzzer_seed_corpus.zip ./corpus/
# build
-make -j$(nproc) USE_ASM=No BUILDTYPE=Debug libraries
+if [[ $CXXFLAGS = *sanitize=memory* ]]
+then
+ ASM_BUILD=No
+else
+ ASM_BUILD=Yes
+fi
+make -j$(nproc) USE_ASM=$ASM_BUILD BUILDTYPE=Debug libraries
$CXX $CXXFLAGS -o $OUT/decoder_fuzzer -I./codec/api/svc -I./codec/console/common/inc -I./codec/common/inc -L. -lFuzzingEngine $SRC/decoder_fuzzer.cpp libopenh264.a
diff --git a/projects/openh264/decoder_fuzzer.cpp b/projects/openh264/decoder_fuzzer.cpp
index 2d5abb74..2c639adf 100644
--- a/projects/openh264/decoder_fuzzer.cpp
+++ b/projects/openh264/decoder_fuzzer.cpp
@@ -26,6 +26,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
int32_t i;
int32_t iBufPos = 0;
int32_t iEndOfStreamFlag;
+ int iLevelSetting = (int) WELS_LOG_QUIET; // disable logging while fuzzing
int32_t iSliceSize;
ISVCDecoder *pDecoder;
SDecodingParam sDecParam = {0};
@@ -40,11 +41,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
// TODO: is this the best/fastest ERROR_CON to use?
sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
- // TODO: should we also fuzz VIDEO_BITSTREAM_SVC
+ // TODO: should we also fuzz VIDEO_BITSTREAM_SVC?
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_AVC;
WelsCreateDecoder (&pDecoder);
pDecoder->Initialize (&sDecParam);
+ pDecoder->SetOption (DECODER_OPTION_TRACE_LEVEL, &iLevelSetting);
while (1) {
if (iBufPos >= size) {