]> git.sesse.net Git - vlc/commitdiff
XCB/X11: validate scanline pad correctly
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 15 Feb 2011 19:18:59 +0000 (21:18 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 15 Feb 2011 19:18:59 +0000 (21:18 +0200)
modules/video_output/xcb/x11.c

index 5a323da9eaa7b819d185809c2721565df9713f8d..6ed67631bc6f717f8c4aea807d9b524da6dbb193 100644 (file)
@@ -179,15 +179,16 @@ static int Open (vlc_object_t *obj)
             continue;
         }
 
-        /* VLC pads lines to 16 pixels internally */
-        if ((fmt->bits_per_pixel << 4) % fmt->scanline_pad)
-            continue;
-
         /* Byte sex is a non-issue for 8-bits. It can be worked around with
          * RGB masks for 24-bits. Too bad for 15-bits and 16-bits. */
         if (fmt->bits_per_pixel == 16 && setup->image_byte_order != ORDER)
             continue;
 
+        /* Make sure the X server is sane */
+        assert (fmt->bits_per_pixel > 0);
+        if (unlikely(fmt->scanline_pad % fmt->bits_per_pixel))
+            continue;
+
         /* Check that the selected screen supports this depth */
         const xcb_depth_t *d = FindDepth (scr, fmt->depth);
         if (d == NULL)