thread: Use a flexible array member for "array" in SDL_TLSData.
Avoids UBSan warning (among other similar ones in SDL_thread.c): src/thread/SDL_thread.c:109:13: runtime error: index 1 out of bounds for type 'struct (unnamed struct at src/thread/SDL_thread_c.h:70:5)[1]' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/thread/SDL_thread.c:109:13
This commit is contained in:
committed by
Sam Lantinga
parent
e62d6a95b9
commit
f9395a766f
@@ -67,11 +67,18 @@ extern void SDL_RunThread(SDL_Thread *thread);
|
||||
typedef struct
|
||||
{
|
||||
int limit;
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4200) // Flexible array members (C99)
|
||||
#endif
|
||||
struct
|
||||
{
|
||||
void *data;
|
||||
void(SDLCALL *destructor)(void *);
|
||||
} array[1];
|
||||
} array[];
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
} SDL_TLSData;
|
||||
|
||||
// This is how many TLS entries we allocate at once
|
||||
|
||||
Reference in New Issue
Block a user