Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc

Issue 2377293002: [libfuzzer] libpng_read_fuzzer: call png_set_user_limits() for MSan. (Closed)
Patch Set: Rebase onto fresh master checkout. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
diff --git a/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc b/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
index 1ea45d36c565ad305b889ec67482bbf30bfc216f..06bae03207358e885ca1490d6bee87f6e4cbea89 100644
--- a/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
@@ -46,6 +46,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
assert(png_ptr);
+#ifdef MEMORY_SANITIZER
+ // To avoid OOM with MSan (crbug.com/648073). These values are recommended as
+ // safe settings by https://github.com/glennrp/libpng/blob/libpng16/pngusr.dfa
+ png_set_user_limits(png_ptr, 65535, 65535);
+#endif
+
png_set_crc_action(png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
png_infop info_ptr = png_create_info_struct(png_ptr);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698