@@ -37,8 +37,9 @@ constexpr FXDIB_Format kFormat[] = {
37
37
38
38
extern " C" int LLVMFuzzerTestOneInput (const uint8_t * data, size_t size) {
39
39
static constexpr size_t kParameterSize = 33 ;
40
- if (size < kParameterSize )
40
+ if (size < kParameterSize ) {
41
41
return 0 ;
42
+ }
42
43
43
44
int width = GetInteger (data);
44
45
int height = GetInteger (data + 4 );
@@ -57,13 +58,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
57
58
size -= kParameterSize ;
58
59
data += kParameterSize ;
59
60
60
- static constexpr uint32_t kMemLimit = 512000000 ; // 512 MB
61
+ static constexpr uint32_t kMemLimit = 128'000'000 ;
61
62
static constexpr uint32_t kComponents = 4 ;
62
63
FX_SAFE_UINT32 mem = width;
63
64
mem *= height;
64
65
mem *= kComponents ;
65
- if (!mem.IsValid () || mem.ValueOrDie () > kMemLimit )
66
+ if (!mem.IsValid () || mem.ValueOrDie () > kMemLimit ) {
66
67
return 0 ;
68
+ }
67
69
68
70
auto src_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
69
71
auto dest_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
@@ -76,8 +78,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
76
78
}
77
79
78
80
std::unique_ptr<CFX_AggClipRgn> clip_rgn;
79
- if (is_clip)
81
+ if (is_clip) {
80
82
clip_rgn = std::make_unique<CFX_AggClipRgn>(width, height);
83
+ }
81
84
if (src_bitmap->IsMaskFormat ()) {
82
85
dest_bitmap->CompositeMask (dest_left, dest_top, width, height,
83
86
std::move (src_bitmap), argb, src_left, src_top,
0 commit comments