[vlc-commits] XCB/X11: validate scanline pad correctly

Rémi Denis-Courmont git at videolan.org
Tue Feb 15 21:49:59 CET 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 15 21:18:59 2011 +0200| [bfb2ff3fb0c0fbd5e3c7b7addba9da4dc546efb6] | committer: Rémi Denis-Courmont

XCB/X11: validate scanline pad correctly

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

 modules/video_output/xcb/x11.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 5a323da..6ed6763 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -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)



More information about the vlc-commits mailing list