Skip to content

Crashes on Windows#7705

Closed
mrjoel wants to merge 1 commit into
cppcheck-opensource:mainfrom
mrjoel:mrjoel/msvc-crash
Closed

Crashes on Windows#7705
mrjoel wants to merge 1 commit into
cppcheck-opensource:mainfrom
mrjoel:mrjoel/msvc-crash

Conversation

@mrjoel

@mrjoel mrjoel commented Jul 25, 2025

Copy link
Copy Markdown
Contributor

(I'm working through impediments with issue tracking access, creating here for sharing information).

The 2.18.0 release crashes when running on some internal project code. When running in Debug, the assert at https://github.com/danmar/cppcheck/blob/2.18.0/lib/astutils.cpp#L778 is hit. When running in Release, it continues past and gets an invalid access two lines later.

I've so far distilled it down to the following reproducer.

struct Thing
{
  int thing;
  // Uncommenting this unneeded padding variable avoids crash.
  //int other;
};

template<typename T>
class Wrapper
{
public:
  Wrapper(){}

  Wrapper(int val1, int* val2)
  {
    mItem = new T(val1, val2);
  }

private:
  T mItem;
};

class ThingWrapper
{

  Wrapper<Thing*> mThing;

  //int foo = 5;
  //Wrapper<Thing*> mThing{4, &foo};
};

@sonarqubecloud

Copy link
Copy Markdown

@mrjoel mrjoel changed the title 2.18.0 crashes on Windows Crashes on Windows Jul 25, 2025
@chrchr-github

Copy link
Copy Markdown
Collaborator

Thanks for reporting, see https://trac.cppcheck.net/ticket/14036
Do you intend on working on this PR?

@mrjoel

mrjoel commented Jul 28, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for adding to tracker. I've been able to get the reproducer (further minimized in issue, thanks) but don't likely have time to work the PR itself. Closing now that issue is tracked.

@mrjoel mrjoel closed this Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants