Skip to content

Commit 4c7aaa9

Browse files
committed
More fuzzer fixes
- allow for malloc to return 0. - do not go through big resizing BUG: oss-fuzz:4667732529577984, oss-fuzz:6595689259008000 Change-Id: I56892bbba2fbcf5d1ceede2b56ea34612f8d13ac
1 parent f776da4 commit 4c7aaa9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/fuzzer/enc_dec_fuzzer.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ void EncDecTest(bool use_argb, fuzz_utils::WebPPictureCpp pic_cpp,
191191
fprintf(stderr, "WebPInitDecoderConfig failed.\n");
192192
abort();
193193
}
194+
if (decoder_options.use_scaling &&
195+
static_cast<size_t>(decoder_options.scaled_width) *
196+
decoder_options.scaled_height >
197+
1000u * 1000u) {
198+
// Skip huge scaling.
199+
return;
200+
}
194201

195202
dec_config.output.colorspace = static_cast<WEBP_CSP_MODE>(colorspace);
196203
std::memcpy(&dec_config.options, &decoder_options, sizeof(decoder_options));

tests/fuzzer/oss-fuzz/build.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,9 @@ for fuzz_main_file in $FUZZ_TEST_BINARIES_OUT_PATHS; do
7474
# LLVMFuzzerTestOneInput for fuzzer detection.
7575
this_dir=\$(dirname "\$0")
7676
export TEST_DATA_DIRS=\$this_dir/corpus
77-
filtered_args=()
78-
for arg in "\$@"; do
79-
if [[ "\$arg" == -rss_limit_mb=* ]]; then
80-
continue
81-
else
82-
filtered_args+=("\$arg")
83-
fi
84-
done
77+
export ASAN_OPTIONS="\${ASAN_OPTIONS}:allocator_may_return_null=1"
8578
chmod +x \$this_dir/$fuzz_basename
86-
\$this_dir/$fuzz_basename --fuzz=$fuzz_entrypoint -- "\${filtered_args[@]}" -rss_limit_mb=0
79+
\$this_dir/$fuzz_basename --fuzz=$fuzz_entrypoint -- \$@
8780
chmod -x \$this_dir/$fuzz_basename
8881
EOF
8982
chmod +x $OUT/$TARGET_FUZZER

0 commit comments

Comments
 (0)