microsoft / microsoft/vscode-cpptools

Opening a special code can cause memory to rise and crash

Open
#10,904 1 comment 0 reactions 1 assignee View on GitHub

@Colengms is already working on this.

Since May 1, 2023.

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

Description

Environment
  • OS and Version: Windows 11 22621.1555
  • VS Code Version: 1.77.3
  • C/C++ Extension Version: v1.14.5
  • If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce

Bug Summary:
Opening a special code can cause memory to rise and crash

Steps to reproduce:

  1. Create a new .cpp file
  2. Copy the following code to this file
#include<bits/stdc++.h>
using namespace std;
template <int n>
struct a
{
};
template <size_t... i>
unsigned long long a1(index_sequence<i...>, int n)
{
    constexpr std::array<unsigned long long, sizeof...(i)> ret = {tmp<i>::val...};
    return ret[n];
};
unsigned long long a2(int n)
{
    return a1(make_index_sequence<2000000000>(), n);
}

Expected behavior:
Rapid increase in memory usage

Configuration and Logs
-------- Diagnostics - 2023/5/1 10:56:23
Version: 1.14.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:\\Users\\WiseAnswer\\Desktop/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22621.0",
    "cStandard": "c11",
    "cppStandard": "c++14",
    "intelliSenseMode": "windows-gcc-x64",
    "intelliSenseModeIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "compilerPath": "C:\\Program Files\\mingw64\\bin\\g++.exe",
    "compilerPathIsExplicit": true,
    "browse": {
        "limitSymbolsToIncludedHeaders": true,
        "path": [
            "${workspaceFolder}/**"
        ]
    }
}
No active translation units.
Other Extensions

No response

Additional context

No response

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.