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

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

Issue 1808123004: [libfuzzer] Add a sanity check for too big images in libpng_read_fuzzer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 5d6654e25b4af6255d0ab7f0c8c4b96334e6f1c0..6393c28d52a6f7c3849a2cbbbcab841f1977eb9f 100644
--- a/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
@@ -70,7 +70,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0;
}
- // Reading
+ // Reading.
png_read_info(png_ptr, info_ptr);
png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
base::ScopedClosureRunner png_deleter(base::Bind(
@@ -91,6 +91,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0;
}
+ // This is going to be too slow.
+ if (height * width > 100000000)
krasin 2016/03/17 17:02:48 what if height * width overflow?
+ return 0;
+
int passes = png_set_interlace_handling(png_ptr);
png_start_read_image(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