[vlc-commits] vout/macosx: Fix null pointer dereferencing

Marvin Scholz git at videolan.org
Thu Nov 29 16:37:07 CET 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Nov 29 16:26:12 2018 +0100| [2186bb10ac0920fa7f90384dbde8e6d0dce82a0b] | committer: Marvin Scholz

vout/macosx: Fix null pointer dereferencing

In VLCOpenGLVideoView the vout_display_t vd instance variable is
protected by a mutex on the instance (self), so vd can only safely
be accessed in a @synchronized(self) block, not outside of it.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2186bb10ac0920fa7f90384dbde8e6d0dce82a0b
---

 modules/video_output/macosx.m | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index f33e823391..8e85d6139d 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -636,6 +636,7 @@ static void OpenglSwap (vlc_gl_t *gl)
 
     /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
     NSRect bounds = [self convertRectToBacking:[self bounds]];
+    vout_display_place_t place;
 
     @synchronized(self) {
         if (vd) {
@@ -645,14 +646,14 @@ static void OpenglSwap (vlc_gl_t *gl)
 
             vout_display_PlacePicture (&sys->place, &vd->source, &sys->cfg, false);
             vout_window_ReportSize(sys->embed, bounds.size.width, bounds.size.height);
+            place = sys->place;
         }
     }
 
     if ([self lockgl]) {
-        vout_display_sys_t *sys = vd->sys;
         // x / y are top left corner, but we need the lower left one
-        glViewport (sys->place.x, bounds.size.height - (sys->place.y + sys->place.height),
-                    sys->place.width, sys->place.height);
+        glViewport (place.x, bounds.size.height - (place.y + place.height),
+                    place.width, place.height);
 
         @synchronized(self) {
             // This may be cleared before -drawRect is being called,



More information about the vlc-commits mailing list