Bug 1499758 - Fix potential null pointer deref in WebGLContext::GetVRFrame r=jgilbert
authorImanol Fernandez <mortimergoro@gmail.com>
Wed, 21 Nov 2018 10:34:52 +0000
changeset 503889 fbebc15cd4f40f0978bf22def0fcf355ce69f27b
parent 503888 cfde782a9b546f9282469c932011644db7a396a1
child 503890 d4a142e1648b3e341fb0f486d7b15a0bad7e0904
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1499758
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1499758 - Fix potential null pointer deref in WebGLContext::GetVRFrame r=jgilbert Differential Revision: https://phabricator.services.mozilla.com/D12480
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -2323,28 +2323,28 @@ WebGLContext::GetVRFrame()
     sharedSurface->Surf()->ProducerRelease();
 
     return sharedSurface.forget();
 }
 #else
 already_AddRefed<layers::SharedSurfaceTextureClient>
 WebGLContext::GetVRFrame()
 {
+  if (!gl)
+      return nullptr;
+
   EnsureVRReady();
   /**
    * Swap buffers as though composition has occurred.
    * We will then share the resulting front buffer to be submitted to the VR
    * compositor.
    */
   BeginComposition();
   EndComposition();
 
-  if (!gl)
-      return nullptr;
-
   gl::GLScreenBuffer* screen = gl->Screen();
   if (!screen)
       return nullptr;
 
   RefPtr<SharedSurfaceTextureClient> sharedSurface = screen->Front();
   if (!sharedSurface)
       return nullptr;