antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

[C++]Fix crashes in TokenStreamRewriter

Open tcy-bitstothings opened this issue 3 years ago • 2 comments

Signed-off-by: Tomasz Cybulski [email protected]

A simple PR fixing crashes in cpp TokenStreamRewriter. Rewrite operation objects were accessed after deletion.

tcy-bitstothings avatar Oct 02 '22 23:10 tcy-bitstothings

Hmm... why is iop not available after delete? My C++ is rusty.

parrt avatar Feb 19 '23 18:02 parrt

Hmm... why is iop not available after delete? My C++ is rusty.

Because iop is merely a pointer addressing the same instance as in rewrites. If the entry in rewrites is deleted that basically means iop is pointing to garbage now.

And, Yes, these are legitimate crash bugs in cpp implementation. However, this PR doesn't fix the underlying issue.

Introducing PR #4566 to fix the issue and verified.

hs-apotell avatar Mar 26 '24 10:03 hs-apotell