Skip to content

Commit 8a1ef03

Browse files
dinordnetkex
authored andcommitted
demangle: Add complexity guard to ParseQRequiresExpr
This function copies the parser's state onto the stack in order to perform backtracking. Adding a complexity guard will ensure that it fails gracefully, instead of contributing to excessive consumption of stack space. PiperOrigin-RevId: 606720511 Change-Id: I2f6f03e5f8bc4cc571a4159ecfc2af6f3e00fa68
1 parent 01280e3 commit 8a1ef03

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

absl/debugging/internal/demangle.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,8 @@ static bool ParseExprCastValue(State *state) {
19421942
// template <typename T>
19431943
// int foo(T);
19441944
static bool ParseQRequiresClauseExpr(State *state) {
1945+
ComplexityGuard guard(state);
1946+
if (guard.IsTooComplex()) return false;
19451947
ParseState copy = state->parse_state;
19461948
DisableAppend(state);
19471949

0 commit comments

Comments
 (0)