From 018d49ce36131b374e4e8d808916701b1d8a9943 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Mon, 16 Dec 2024 07:18:10 +0100 Subject: [PATCH] don't allow to set palette to surface that isn't 8bpp --- src/ddsurface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ddsurface.c b/src/ddsurface.c index d8aafda59c..18ebb27831 100644 --- a/src/ddsurface.c +++ b/src/ddsurface.c @@ -1091,6 +1091,9 @@ HRESULT dds_SetColorKey(IDirectDrawSurfaceImpl* This, DWORD dwFlags, LPDDCOLORKE HRESULT dds_SetPalette(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* lpDDPalette) { + if (This->bpp != 8) + return DDERR_INVALIDPIXELFORMAT; + if (lpDDPalette) IDirectDrawPalette_AddRef(lpDDPalette);