libiberty: demangler crash with missing :? or fold expression component.
authorMark Wielaard <mark@klomp.org>
Tue, 15 Nov 2016 19:31:59 +0000 (19:31 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Tue, 15 Nov 2016 19:31:59 +0000 (19:31 +0000)
commit168126e59828b8d2cc8cbb7e03fbe8341177f58f
tree8f5009b475fabf82e2a02e550cfd3e7eac405f5d
parent0d0bfbf47c67397b8380d5cd47aec8429888b196
libiberty: demangler crash with missing :? or fold expression component.

When constructing an :? or fold expression that requires a third
expression only the first and second were explicitly checked to
not be NULL. Since the third expression is also required in these
constructs it needs to be explicitly checked and rejected when missing.
Otherwise the demangler will crash once it tries to d_print the
NULL component. Added two examples to demangle-expected of strings
that would crash before this fix.

Found by American Fuzzy Lop (afl) fuzzer.

From-SVN: r242451
libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected