The color map support in wsfb(4) only supports up to 256 palette entries.

However for 30-bit color depth modes, Xorg assumes 1024 palette entries are
supported.  Since we don't actually support hardware with both 30-bit
color depth and hardware palette support, skip the color map handling in
that case.  This is what the xf86-video-ati driver does as well.
This prevents us from smashing the stack.

ok matthieu@
This commit is contained in:
kettenis
2022-02-07 18:38:44 +00:00
parent 95a0b395e8
commit 648a8d44df

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: wsfb_driver.c,v 1.39 2021/03/13 14:00:04 kettenis Exp $ */
/* $OpenBSD: wsfb_driver.c,v 1.40 2022/02/07 18:38:44 kettenis Exp $ */
/*
* Copyright © 2001-2012 Matthieu Herrb
* All rights reserved.
@@ -1034,7 +1034,8 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
/* On StaticGray visuals, fake a 256 entries colormap. */
if (ncolors == 0)
ncolors = 256;
if(!xf86HandleColormaps(pScreen, ncolors, 8, WsfbLoadPalette,
if (pScrn->depth != 30 &&
!xf86HandleColormaps(pScreen, ncolors, 8, WsfbLoadPalette,
NULL, flags))
return FALSE;