[Windows] Fix cmd line tokenization of unclosed quotes.
When cl::TokenizeWindowsCommandLine received a command line with an unterminated double-quoted string at the end, it would discard the text within that string. That doesn't match the behavior of the standard Windows C library, which will return the text in the unclosed quoted string as an argv word. Fixed, and added extra unit tests in that area. In some cases (specifically the one in Bugzilla #47579) this could cause TokenizeWindowsCommandLine to return a zero-length list of arguments, leading to an array overrun at the call site in windows::GetCommandLineArguments. Added a check there, for extra safety: now windows::GetCommandLineArguments will return an error code instead of failing an assertion. (This change was written as part of https://reviews.llvm.org/D122914, but split into a separate commit at the last minute at the code reviewer's suggestion, because it's fixing an unrelated bug in the same area. The rest of D122914 will follow in the next commit.)
Loading
Please sign in to comment