Skip to content

Commit

Permalink
Fix crash when format specifiers are passed
Browse files Browse the repository at this point in the history
  • Loading branch information
huiren-jiang authored and heaths committed Jun 28, 2019
1 parent 74d63d7 commit a6d40ba
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docker/Tests/vswhere.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ Describe 'vswhere' {
@($instances.instances.instance).Count | Should Be 1
@($instances.instances.instance)[0].instanceId | Should Be 2
}

It 'does not crash when passed %0' {
$message = C:\bin\vswhere.exe -version '%0'
$message[-1] | Should Be 'Error 0x57: The version "%0" is not a valid version range'
}
}

Context '-latest' {
Expand Down
1 change: 1 addition & 0 deletions inc/Common.Debug.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<LanguageStandard>stdcpp14</LanguageStandard>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Lib>
Expand Down
1 change: 1 addition & 0 deletions inc/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<LanguageStandard>stdcpp14</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Lib>
Expand Down
2 changes: 1 addition & 1 deletion src/vswhere/Program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int wmain(_In_ int argc, _In_ LPCWSTR argv[])
const auto* err = dynamic_cast<const win32_error*>(&ex);
if (err)
{
console.WriteLine(err->wwhat());
console.WriteLine(L"%ls", err->wwhat());
}
else
{
Expand Down

0 comments on commit a6d40ba

Please sign in to comment.