From 648a8d44dffa8a069543e61b6232a08422304f6c Mon Sep 17 00:00:00 2001 From: kettenis Date: Mon, 7 Feb 2022 18:38:44 +0000 Subject: [PATCH] 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@ --- driver/xf86-video-wsfb/src/wsfb_driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/driver/xf86-video-wsfb/src/wsfb_driver.c b/driver/xf86-video-wsfb/src/wsfb_driver.c index 72a48a9ff..2ae92af4c 100644 --- a/driver/xf86-video-wsfb/src/wsfb_driver.c +++ b/driver/xf86-video-wsfb/src/wsfb_driver.c @@ -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;