Skip to content

Commit

Permalink
[demangler] return early if conditional expr parsing failed
Browse files Browse the repository at this point in the history
This should fix some bugs found by oss-fuzz.

llvm-svn: 324203
  • Loading branch information
epilk committed Feb 5, 2018
1 parent 0398ccd commit 0923542
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libcxxabi/src/cxa_demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2589,10 +2589,15 @@ Node *Db::parseExpr() {
if (First[1] == 'u') {
First += 2;
Node *Cond = parseExpr();
if (Cond == nullptr)
return nullptr;
Node *LHS = parseExpr();
if (LHS == nullptr)
return nullptr;
Node *RHS = parseExpr();
if (Cond && LHS && RHS)
return make<ConditionalExpr>(Cond, LHS, RHS);
if (RHS == nullptr)
return nullptr;
return make<ConditionalExpr>(Cond, LHS, RHS);
}
return nullptr;
case 'r':
Expand Down

0 comments on commit 0923542

Please sign in to comment.