antlr4
antlr4 copied to clipboard
[C++]Fix crashes in TokenStreamRewriter
Signed-off-by: Tomasz Cybulski [email protected]
A simple PR fixing crashes in cpp TokenStreamRewriter. Rewrite operation objects were accessed after deletion.
Hmm... why is iop not available after delete? My C++ is rusty.
Hmm... why is
iopnot available afterdelete? 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.