Skip to content

Commit b7e1aa3

Browse files
authored
Merge pull request #2843 from pygame-community/ankith26-fix-cursor-error
Add explicit check and error for system cursor
2 parents e78b6a0 + 11ad2f1 commit b7e1aa3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src_c/mouse.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ static PyObject *
345345
_set_system_cursor(int constant)
346346
{
347347
SDL_Cursor *lastcursor, *cursor = NULL;
348+
if (constant < 0 || constant >= SDL_NUM_SYSTEM_CURSORS) {
349+
return RAISE(pgExc_SDLError,
350+
"System cursor constant value out of range");
351+
}
348352

349353
cursor = SDL_CreateSystemCursor(constant);
350354
if (!cursor) {

0 commit comments

Comments
 (0)