Commit 9c9cda0c authored by Ria Jiang's avatar Ria Jiang Committed by Commit Bot

Fix integer overflow in hit_test_query_fuzzer.

HitTestQuery sometimes uses the negation of the position in rect,
making fuzzer min to be (min + 1) to avoid integer overflow after
negation.

Bug: 910592
Test: hit_test_query_fuzzer
Change-Id: I78d1d15467d13d8cb65278dff85408fd22e73c3c
Reviewed-on: https://chromium-review.googlesource.com/c/1372920Reviewed-by: default avatarAbhishek Arya <inferno@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Ria Jiang <riajiang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615907}
parent de20dd46
...@@ -29,8 +29,12 @@ void AddHitTestRegion(base::FuzzedDataProvider* fuzz, ...@@ -29,8 +29,12 @@ void AddHitTestRegion(base::FuzzedDataProvider* fuzz,
? fuzz->ConsumeIntegralInRange<uint32_t>( ? fuzz->ConsumeIntegralInRange<uint32_t>(
1, std::numeric_limits<uint32_t>::max()) 1, std::numeric_limits<uint32_t>::max())
: viz::AsyncHitTestReasons::kNotAsyncHitTest; : viz::AsyncHitTestReasons::kNotAsyncHitTest;
gfx::Rect rect(fuzz->ConsumeIntegral<int>(), fuzz->ConsumeIntegral<int>(), gfx::Rect rect(
fuzz->ConsumeIntegral<int>(), fuzz->ConsumeIntegral<int>()); fuzz->ConsumeIntegralInRange<int>(std::numeric_limits<int>::min() + 1,
std::numeric_limits<int>::max()),
fuzz->ConsumeIntegralInRange<int>(std::numeric_limits<int>::min() + 1,
std::numeric_limits<int>::max()),
fuzz->ConsumeIntegral<int>(), fuzz->ConsumeIntegral<int>());
int32_t child_count = int32_t child_count =
depth < kMaxDepthAllowed ? fuzz->ConsumeIntegralInRange(0, 10) : 0; depth < kMaxDepthAllowed ? fuzz->ConsumeIntegralInRange(0, 10) : 0;
gfx::Transform transform; gfx::Transform transform;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment