[vlc-commits] direct3d11: fix crash when subpictures have nil dimensions

Steve Lhomme git at videolan.org
Thu Oct 13 11:05:13 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Oct 13 10:00:56 2016 +0200| [3ae059e6cf418fdeb2f976a5a518264513f6f724] | committer: Jean-Baptiste Kempf

direct3d11: fix crash when subpictures have nil dimensions

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_output/win32/direct3d11.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 3167e60..a7ba16e 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -939,7 +939,8 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
     if (subpicture) {
         // draw the additional vertices
         for (int i = 0; i < sys->d3dregion_count; ++i) {
-            DisplayD3DPicture(sys, (d3d_quad_t *) sys->d3dregions[i]->p_sys);
+            if (sys->d3dregions[i])
+                DisplayD3DPicture(sys, (d3d_quad_t *) sys->d3dregions[i]->p_sys);
         }
     }
 
@@ -1979,6 +1980,9 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
 
     int i = 0;
     for (subpicture_region_t *r = subpicture->p_region; r; r = r->p_next, i++) {
+        if (!r->fmt.i_width || !r->fmt.i_height)
+            continue; // won't render anything, keep the cache for later
+
         for (int j = 0; j < sys->d3dregion_count; j++) {
             picture_t *cache = sys->d3dregions[j];
             if (cache != NULL && ((d3d_quad_t *) cache->p_sys)->pTexture) {



More information about the vlc-commits mailing list