[vlc-commits] [Git][videolan/vlc][master] 2 commits: vout/sample buffer display: fix use-after-free

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Jul 2 14:54:58 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
af61becb by Felix Paul Kühne at 2026-07-02T14:21:24+00:00
vout/sample buffer display: fix use-after-free

Snapshot vd and the placement on the display thread and use the
captured copies inside the block.

- - - - -
82803f4e by Felix Paul Kühne at 2026-07-02T14:21:24+00:00
vout/sample buffer display: drop unused vd references

- - - - -


1 changed file:

- modules/video_output/apple/VLCSampleBufferDisplay.m


Changes:

=====================================
modules/video_output/apple/VLCSampleBufferDisplay.m
=====================================
@@ -563,18 +563,15 @@ static void DeletePipController( pip_controller_t * pipcontroller );
 #pragma mark -
 
 @interface VLCSampleBufferDisplayView: VLCView <CALayerDelegate>
- at property (nonatomic, readonly) vout_display_t *vd;
-- (instancetype)initWithVoutDisplay:(vout_display_t *)vd;
 - (AVSampleBufferDisplayLayer *)displayLayer;
 @end
 
 @implementation VLCSampleBufferDisplayView
 
-- (instancetype)initWithVoutDisplay:(vout_display_t *)vd {
+- (instancetype)init {
     self = [super init];
     if (!self)
         return nil;
-    _vd = vd;
 #if TARGET_OS_OSX
     self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
     self.wantsLayer = YES;
@@ -736,6 +733,7 @@ shouldInheritContentsScale:(CGFloat)newScale
     }
 
     VLCSampleBufferDisplay *sys = self;
+    vout_display_place_t place = *_vd->place;
     dispatch_async(dispatch_get_main_queue(), ^{
         if (sys.displayView)
             return;
@@ -744,13 +742,12 @@ shouldInheritContentsScale:(CGFloat)newScale
         VLCSampleBufferSubpictureView *spuView;
         VLCView *window = sys.window;
 
-        displayView =
-            [[VLCSampleBufferDisplayView alloc] initWithVoutDisplay:sys.vd];
+        displayView = [[VLCSampleBufferDisplayView alloc] init];
         spuView = [VLCSampleBufferSubpictureView new];
         [window addSubview:displayView];
         [window addSubview:spuView];
 
-        displayView.frame = [sys frameForPlace:sys.vd->place];
+        displayView.frame = [sys frameForPlace:&place];
         [spuView setFrame:[window bounds]];
 
         sys.displayView = displayView;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f4fa30dc9a961c83826b05178ecc1f28b6938943...82803f4e26ddb26f0b8ed228b5bfeaad1c92a001

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f4fa30dc9a961c83826b05178ecc1f28b6938943...82803f4e26ddb26f0b8ed228b5bfeaad1c92a001
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list