Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

Commit 9232d7c

Browse files
leizleizPdfium LUCI CQ
authored andcommitted
Reduce max bitmap size for pdf_scanlinecompositor_fuzzer
Reduce the maximum allowed bitmap size to avoid timeouts. Bug: 40220792 Change-Id: Iab3fa8915915e2adfbdbeafca1e7ea2bf5c18485 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/129811 Reviewed-by: Tom Sepez <[email protected]> Commit-Queue: Lei Zhang <[email protected]> Reviewed-by: Thomas Sepez <[email protected]>
1 parent 122a3ad commit 9232d7c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ constexpr FXDIB_Format kFormat[] = {
3737

3838
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
3939
static constexpr size_t kParameterSize = 33;
40-
if (size < kParameterSize)
40+
if (size < kParameterSize) {
4141
return 0;
42+
}
4243

4344
int width = GetInteger(data);
4445
int height = GetInteger(data + 4);
@@ -57,13 +58,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
5758
size -= kParameterSize;
5859
data += kParameterSize;
5960

60-
static constexpr uint32_t kMemLimit = 512000000; // 512 MB
61+
static constexpr uint32_t kMemLimit = 128'000'000;
6162
static constexpr uint32_t kComponents = 4;
6263
FX_SAFE_UINT32 mem = width;
6364
mem *= height;
6465
mem *= kComponents;
65-
if (!mem.IsValid() || mem.ValueOrDie() > kMemLimit)
66+
if (!mem.IsValid() || mem.ValueOrDie() > kMemLimit) {
6667
return 0;
68+
}
6769

6870
auto src_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
6971
auto dest_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
@@ -76,8 +78,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
7678
}
7779

7880
std::unique_ptr<CFX_AggClipRgn> clip_rgn;
79-
if (is_clip)
81+
if (is_clip) {
8082
clip_rgn = std::make_unique<CFX_AggClipRgn>(width, height);
83+
}
8184
if (src_bitmap->IsMaskFormat()) {
8285
dest_bitmap->CompositeMask(dest_left, dest_top, width, height,
8386
std::move(src_bitmap), argb, src_left, src_top,

0 commit comments

Comments
 (0)