From b79db0a6eada9c64a9eb290b60af8dadc5496ffd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 12 Oct 2023 06:22:34 -0700 Subject: [PATCH] Fixed potential wraparound issue with property IDs --- src/SDL_properties.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SDL_properties.c b/src/SDL_properties.c index 29dd2391e1..6fa46fbf32 100644 --- a/src/SDL_properties.c +++ b/src/SDL_properties.c @@ -124,7 +124,11 @@ SDL_PropertiesID SDL_CreateProperties(void) } if (SDL_LockRWLockForWriting(SDL_properties_lock) == 0) { - props = ++SDL_last_properties_id; + ++SDL_last_properties_id; + if (SDL_last_properties_id == 0) { + ++SDL_last_properties_id; + } + props = SDL_last_properties_id; if (SDL_InsertIntoHashTable(SDL_properties, (const void *)(uintptr_t)props, properties)) { inserted = SDL_TRUE; }