microsoft / microsoft/vscode-cpptools

Text in "setupCommands" not properly escaped for XML

Open
#6,288 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Debugger

Describe the bug

  • OS and Version: Windows 10 Pro (64-bit) 10.0.19041
  • Remote OS version: Ubuntu 16.04.7 LTS - Linux x64 4.19.128-microsoft-standard
  • VS Code Version: Code 1.50.0
  • C/C++ Extension Version: 1.0.1
  • Other extensions you installed (and if the issue persists after disabling them): -

Text in setupCommands in a launch configuration is not properly escaped for use in an internally generated XML.

To Reproduce

Debug the following launch configuration in launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "setup command text bug",
            "type": "cppdbg",
            "request": "launch",
            "program": "/bin/cat",
            "args": [],  // unused for demonstration purposes
            "stopAtEntry": true,
            "cwd": "/bin",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "logging": {
                "engineLogging": true
            },
            "setupCommands": [
                {
                    "text": "-exec-arguments </dev/null"
                }
            ]
        }
    ]
}

This gives the error:

Code_PwKgqFSC9x

It's possible that other similar settings like customLaunchSetupCommands exhibit the same issue.

Log:

1: (249) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
1: (276) LaunchOptions  ExePath='/bin/cat'
1: (277) LaunchOptions  WorkingDirectory='/bin'
1: (277) LaunchOptions  ExeArguments=''
1: (277) LaunchOptions  MIMode='gdb'
1: (277) LaunchOptions  MIDebuggerPath=''
1: (277) LaunchOptions  WaitDynamicLibLoad='false'
1: (277) LaunchOptions>
1: (277) LaunchOptions    <SetupCommands>
1: (277) LaunchOptions        <Command IgnoreFailures='false' Description=''>-exec-arguments </dev/null</Command>
1: (277) LaunchOptions    </SetupCommands>
1: (277) LaunchOptions</LocalLaunchOptions>
1: (356) Send Event AD7MessageEvent

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the launch.json reproduction and the setupCommands handling in the VS Code C/C++ extension, then run the debugger with the shown command containing <. Confirm that the internally generated XML is well-formed and that the setup command is passed through without causing the reported launch error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.