Commit 94ccfefd authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Add calls to SetDisplayRect(...) to trigger eliding code

This CL is adding coverage of SetDisplayRect(...) to the RenderText API
fuzzer.

This is required to trigger the eliding code. Eliding occurs only when
the text can't fit the display rect. The fuzzer should have caught that
bug (crbug/1142020).

We are expecting a new series of bugs from clusterfuzz after landing
this change. These bugs are not recently added to chrome but should
be fixed.

Bug: 1142020
Change-Id: Id0fcfb025651286f4c474004ef8f93b48fb0e281
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522605
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825539}
parent 83fc4bd3
...@@ -85,7 +85,8 @@ enum class RenderTextAPI { ...@@ -85,7 +85,8 @@ enum class RenderTextAPI {
kIsGraphemeBoundary, kIsGraphemeBoundary,
kIndexOfAdjacentGrapheme, kIndexOfAdjacentGrapheme,
kSetObscuredGlyphSpacing, kSetObscuredGlyphSpacing,
kMaxValue = kSetObscuredGlyphSpacing kSetDisplayRect,
kMaxValue = kSetDisplayRect
}; };
gfx::DirectionalityMode ConsumeDirectionalityMode(FuzzedDataProvider* fdp) { gfx::DirectionalityMode ConsumeDirectionalityMode(FuzzedDataProvider* fdp) {
...@@ -345,6 +346,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -345,6 +346,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
render_text->SetObscuredGlyphSpacing( render_text->SetObscuredGlyphSpacing(
fdp.ConsumeIntegralInRange<size_t>(0, 10)); fdp.ConsumeIntegralInRange<size_t>(0, 10));
break; break;
case RenderTextAPI::kSetDisplayRect:
render_text->SetDisplayRect(
gfx::Rect(fdp.ConsumeIntegralInRange<int>(-30, 30),
fdp.ConsumeIntegralInRange<int>(-30, 30),
fdp.ConsumeIntegralInRange<int>(0, 200),
fdp.ConsumeIntegralInRange<int>(0, 30)));
break;
} }
} }
......
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