Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2950233002: Validate untrusted VR mojo inputs into browser process (Closed)
Patch Set: make validation less strict, and fix a bug found with validation Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index e161005f8d4698aba5e9f3fceae5de5c7c75b5d8..9d43361890648e551aab3b23d3c5a7cb9e34ddbf 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -372,6 +372,28 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* script_state,
return promise;
}
+ for (float value : layer_.leftBounds()) {
mthiesse 2017/07/11 14:52:24 Should move these checks into UpdateLayerBounds(),
billorr 2017/07/13 00:31:41 It is called from multiple places, but this is the
+ if (std::isnan(value)) {
+ ForceExitPresent();
+ DOMException* exception = DOMException::Create(
+ kInvalidStateError, "Layer bounds must not contain NAN values");
+ resolver->Reject(exception);
+ ReportPresentationResult(PresentationResult::kInvalidLayerBounds);
+ return promise;
+ }
+ }
+
+ for (float value : layer_.rightBounds()) {
+ if (std::isnan(value)) {
+ ForceExitPresent();
+ DOMException* exception = DOMException::Create(
+ kInvalidStateError, "Layer bounds must not contain NAN values");
+ resolver->Reject(exception);
+ ReportPresentationResult(PresentationResult::kInvalidLayerBounds);
+ return promise;
+ }
+ }
+
mthiesse 2017/07/11 14:52:24 Also check the width/height to be >= 0 to avoid un
billorr 2017/07/13 00:31:41 I removed the size check on the other side. We al
if (!pending_present_resolvers_.IsEmpty()) {
// If we are waiting on the results of a previous requestPresent call don't
// fire a new request, just cache the resolver and resolve it when the
@@ -697,6 +719,9 @@ void VRDisplay::submitFrame() {
TRACE_EVENT_END0("gpu", "VRDisplay::SubmitFrame");
did_submit_this_frame_ = true;
+ // Reset our frame id, since anything we'd want to do (resizing/etc) can
+ // no-longer happen to this frame.
+ vr_frame_id_ = -1;
// If we were deferring a rAF-triggered vsync request, do this now.
RequestVSync();

Powered by Google App Engine
This is Rietveld 408576698