Skip to content

Commit

Permalink
Prevent stripping of format specifiers from -exec commands. (#1277)
Browse files Browse the repository at this point in the history
  • Loading branch information
gareth-rees committed Feb 24, 2022
1 parent a109b93 commit bec2679
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/OpenDebugAD7/AD7DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2862,7 +2862,15 @@ protected override void HandleEvaluateRequestAsync(IRequestResponder<EvaluateArg
{
// If this is an -exec command (or starts with '`') treat it as a console command and log telemetry
if (expression.StartsWith("-exec", StringComparison.Ordinal) || expression[0] == '`')
{
isExecInConsole = true;
// Append a sacrificial comma. The purpose of this comma is to be stripped when
// ParseText calls GetVariable which calls VariableInformation which calls
// StripFormatSpecifier. This protects the expression from being modified in
// the case where it looks as if it ends with a format specifier. See issue
// #1277 for details.
expression += ",";
}
}

int hr;
Expand Down

0 comments on commit bec2679

Please sign in to comment.