From 11ad2f1ebf0e36f77229bce6275e1f4fa740c61a Mon Sep 17 00:00:00 2001 From: Ankith Date: Tue, 7 May 2024 13:57:39 +0530 Subject: [PATCH] Add explicit check and error for system cursor --- src_c/mouse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src_c/mouse.c b/src_c/mouse.c index e4532b5933..8353192f20 100644 --- a/src_c/mouse.c +++ b/src_c/mouse.c @@ -345,6 +345,10 @@ static PyObject * _set_system_cursor(int constant) { SDL_Cursor *lastcursor, *cursor = NULL; + if (constant < 0 || constant >= SDL_NUM_SYSTEM_CURSORS) { + return RAISE(pgExc_SDLError, + "System cursor constant value out of range"); + } cursor = SDL_CreateSystemCursor(constant); if (!cursor) {