Commit 31de4339 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Limit backing scale factor to 100X

Previous to this CL, any value could be passed to this function,
which caused problems if very large values were used. See
https://crbug.com/899482 for an example. Per the discussion there,
100X seems like a reasonable limit.

Bug: 899482
Change-Id: I0ed9b68510bf9462c76dcf85e6954df416c0df2f
Reviewed-on: https://chromium-review.googlesource.com/c/1320015Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarMike Pinkerton <pinkerton@chromium.org>
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606067}
parent b6408920
...@@ -1244,8 +1244,12 @@ std::string TestRunnerBindings::PathToLocalResource(const std::string& path) { ...@@ -1244,8 +1244,12 @@ std::string TestRunnerBindings::PathToLocalResource(const std::string& path) {
void TestRunnerBindings::SetBackingScaleFactor( void TestRunnerBindings::SetBackingScaleFactor(
double value, double value,
v8::Local<v8::Function> callback) { v8::Local<v8::Function> callback) {
// Limit backing scale factor to something "reasonable" - 100x. Without
// this limit, arbitrarily large values can be used, which can lead to
// crashes and other problems: See https://crbug.com/899482.
double limited_value = fmin(100.0, value);
if (view_runner_) if (view_runner_)
view_runner_->SetBackingScaleFactor(value, callback); view_runner_->SetBackingScaleFactor(limited_value, callback);
} }
void TestRunnerBindings::EnableUseZoomForDSF(v8::Local<v8::Function> callback) { void TestRunnerBindings::EnableUseZoomForDSF(v8::Local<v8::Function> callback) {
......
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