Skip to content

xcb/x11: reject unsupported visual classes

Jeffrey Knockel requested to merge jeffk/vlc:reject-unknown-visualtypes into master

On a server configured with Depth 30 I have the following DirectColor visual:

  visual:
    visual id:    0x22
    class:    DirectColor
    depth:    30 planes
    available colormap entries:    1024 per subfield
    red, green, blue masks:    0x3ff00000, 0xffc00, 0x3ff
    significant bits in color specification:    10 bits

Previously in vlc_xcb_VisualToFormat() we didn't do any depth checking on visuals unless they are TrueColor or StaticGray. Thus, other visuals would proceed further through the function and either get accidentally treated as a TrueColor visual or, as in the case of the above visual, we will hit vlc_assert_unreachable() due to its depth (30) not being one that we currently support and due to it evading our earlier depth checking. The fix is to return false earlier if we don't support the visual class.

Merge request reports