Memory corruption bug causes crash in bison 3.6.4

Dwight Guth <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <CAN3DPtG5HHR3GaP6kwVkdnuEnwFrGa20OiQAGS1OF9rZEK4eUw@mail.gmail.com>
I have been able to reproduce this bug in the latest version and in
versions as old as 3.0.4, the oldest version I have tried.

I am attaching the smallest grammar I was able to produce that
generates the error. I'm aware that this grammar is rather contrived;
I can provide a larger, more complete-but-self-contained example upon
request, but the bug reporting instructions recommended I minimize the
grammar as much as possible, so I chose to provide the smallest
grammar I could construct that triggered the crash, even though in
practice it looks nothing like a real production grammar.

The bug manifests with the following error message, followed by bison
aborting without completing successfully or generating any output:
"double free or corrruption (!prev)". I am on Ubuntu 18.04, and I
built bison with gcc 7.5.0. I am also attaching the log generated from
running bison through valgrind on this example, which seems to show a
number of use-after-free violations.

-- 
Dwight Guth

Director of Engineering


Email: [email protected]
parser.y (application/octet-stream, 778 B) - not displayed
valgrind_log (application/octet-stream, 174.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.