| Summary: | Win32: Stack overflow due to recursive SDL_LogOutput on SDL_LogError without console | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Oskar N <oskar.nordquist> |
| Component: | *don't know* | Assignee: | Andreas Schiffler <aschiffler> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P1 | Keywords: | target-2.0.0 |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Windows 7 | ||
Andreas, can you fix this for release? Thanks! Fixed with http://hg.libsdl.org/SDL/rev/af0bd07212bd |
SDL_LogError causes stack overflow due to recursive SDL_LogOutput when no console is attached in Win32 application. This is caused by SDL_SetError being called from SDL_LogOutput on Win32 when AttachConsole fails. SDL_SetError in turn uses SDL_LogError which causes the recursive function call when ERROR priority is enabled for all categories. Tested on both 2.0.0 RC1 and Aug 7 snapshot (7586). Bug is demonstrated by the following code: #include <SDL.h> #if _WIN32 #pragma comment (linker, "/ENTRY:mainCRTStartup") #pragma comment (linker, "/SUBSYSTEM:WINDOWS") #endif int main(int argc, char *argv[]) { SDL_Init(0); SDL_LogSetAllPriority(SDL_LOG_PRIORITY_ERROR); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "test"); /* <-- Stack overflow on win32 without console (subsystem:WINDOWS) */ SDL_Quit(); return 0; }