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

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

Issue 2950233002: Validate untrusted VR mojo inputs into browser process (Closed)
Patch Set: add test and rebase Created 3 years, 5 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
« no previous file with comments | « third_party/WebKit/LayoutTests/vr/requestPresent_reject_NaN_bounds.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 832d9d14bfccf8cd205d5e553cc87c10632de8d5..8c61bfca3bf3c43b192ffe5555a5d0df14fc69f5 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -381,6 +381,28 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* script_state,
return promise;
}
+ for (float value : layer_.leftBounds()) {
+ 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;
+ }
+ }
+
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
@@ -710,6 +732,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();
« no previous file with comments | « third_party/WebKit/LayoutTests/vr/requestPresent_reject_NaN_bounds.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698