syswm: prevent buffer overflow if SDL and app have different config headers.

This only affects Wayland and DirectFB, as a Unix system generally has X11
support. Other platforms also have different sizes for the C union in
question, but are likely the only target for that platform, etc.

Apps that might run on Wayland or DirectFB will need to be compiled against
new headers from an official 2.0.6 release, or be prepared to force the x11
target, or not use SDL_GetWindowWMInfo().

Fixes Bugzilla #3428.
This commit is contained in:
Ryan C. Gordon
2017-06-11 00:50:26 -04:00
parent 6b2c3286e5
commit b10e95e1f3
3 changed files with 40 additions and 2 deletions

View File

@@ -280,8 +280,9 @@ struct SDL_SysWMinfo
} vivante;
#endif
/* Can't have an empty union */
int dummy;
/* Make sure this union is always 64 bytes (8 64-bit pointers). */
/* Be careful not to overflow this if you add a new target! */
Uint8 dummy[64];
} info;
};