We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3338 - console_wmain doesn't null terminate the argv array
Summary: console_wmain doesn't null terminate the argv array
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: main (show other bugs)
Version: HG 2.0
Hardware: All Windows (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-20 08:44 UTC by Simon Hug
Modified: 2016-10-01 18:48 UTC (History)
1 user (show)

See Also:


Attachments
Patch that null terminates the argv array in console_wmain. (577 bytes, patch)
2016-05-20 08:44 UTC, Simon Hug
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Hug 2016-05-20 08:44:41 UTC
Created attachment 2458 [details]
Patch that null terminates the argv array in console_wmain.

The function console_wmain in src/main/windows/SDL_windows_main.c does not null terminate the argument list it is creating. As specified by the C standard, "argv[argc] shall be a null pointer."

The SDLTest framework makes use of that null pointer and some test programs can cause an access violation because it's missing.

The attached patch adds the missing NULL.
Comment 1 Sam Lantinga 2016-10-01 18:48:38 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/db023d8a1c8b