From 8bf9ec69454c290d4d023663fd7befb75fb5aa78 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Wed, 21 May 2025 12:46:57 -0400 Subject: [PATCH] win-capture: Fix crash if cursor size is zero --- plugins/win-capture/cursor-capture.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/win-capture/cursor-capture.c b/plugins/win-capture/cursor-capture.c index a85bf7799..2471c2d51 100644 --- a/plugins/win-capture/cursor-capture.c +++ b/plugins/win-capture/cursor-capture.c @@ -7,6 +7,9 @@ static uint8_t *get_bitmap_data(HBITMAP hbmp, BITMAP *bmp) if (GetObject(hbmp, sizeof(*bmp), bmp) != 0) { uint8_t *output; unsigned int size = bmp->bmHeight * bmp->bmWidthBytes; + if (!size) { + return NULL; + } output = bmalloc(size); GetBitmapBits(hbmp, size, output); @@ -99,6 +102,9 @@ static inline uint8_t *copy_from_mask(ICONINFO *ii, uint32_t *width, uint32_t *h bmp.bmHeight /= 2; pixels = bmp.bmHeight * bmp.bmWidth; + if (!pixels) { + return NULL; + } output = bzalloc(pixels * 4); bottom = bmp.bmWidthBytes * bmp.bmHeight;