From dffabcb94a7e22be71f0d6992bb42070411ac4fb Mon Sep 17 00:00:00 2001 From: Stefanos A Date: Mon, 5 May 2014 12:46:48 +0200 Subject: [PATCH 1/2] [SDL] Fixed a stack corruption issue on win32 --- Source/OpenTK/Platform/SDL2/Sdl2.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/OpenTK/Platform/SDL2/Sdl2.cs b/Source/OpenTK/Platform/SDL2/Sdl2.cs index 11c8c468..3f07e772 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2.cs @@ -1444,6 +1444,12 @@ namespace OpenTK.Platform.SDL2 [FieldOffset(0)] public DropEvent drop; #endif + + // Ensure the structure is big enough + // This hack is necessary, because until we + // map all possible events (see above)s + [FieldOffset(0)] + private unsafe fixed byte reserved[128]; } [StructLayout(LayoutKind.Explicit)] From 52efa3b6298c722b64ba9bf1dcad0fda5e2a4fc9 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Mon, 5 May 2014 15:11:01 +0200 Subject: [PATCH 2/2] [SDL] Improved documentation of Event size hack --- Source/OpenTK/Platform/SDL2/Sdl2.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/Platform/SDL2/Sdl2.cs b/Source/OpenTK/Platform/SDL2/Sdl2.cs index 3f07e772..ed16da50 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2.cs @@ -1446,8 +1446,9 @@ namespace OpenTK.Platform.SDL2 #endif // Ensure the structure is big enough - // This hack is necessary, because until we - // map all possible events (see above)s + // This hack is necessary to ensure compatibility + // with different SDL versions, which might have + // different sizeof(SDL_Event). [FieldOffset(0)] private unsafe fixed byte reserved[128]; }