diff options
author | Chris Mihelich <cmihelic@google.com> | 2024-06-04 11:01:20 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-06-04 11:02:24 -0700 |
commit | b0e72168e573bae16dc523525e40d4eaf20d475e (patch) | |
tree | 8faefe825207fa790d6cdc8a4591894d3585d06d /absl/debugging/internal/demangle.cc | |
parent | 9645a2fb848516b3dec22afb60f4a7a860fe35d1 (diff) |
Avoid signed overflow for Ed <number> _ manglings with large <number>s.
PiperOrigin-RevId: 640213246
Change-Id: Ib0dcf34d52566bfd0e3e9129c4438954aedab8ec
Diffstat (limited to 'absl/debugging/internal/demangle.cc')
-rw-r--r-- | absl/debugging/internal/demangle.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc index 8bff73bb..d338c646 100644 --- a/absl/debugging/internal/demangle.cc +++ b/absl/debugging/internal/demangle.cc @@ -2352,6 +2352,12 @@ static bool ParseLocalNameSuffix(State *state) { (IsDigit(RemainingInput(state)[0]) || RemainingInput(state)[0] == '_')) { int number = -1; Optional(ParseNumber(state, &number)); + if (number < -1 || number > 2147483645) { + // Work around overflow cases. We do not expect these outside of a fuzzer + // or other source of adversarial input. If we do detect overflow here, + // we'll print {default arg#1}. + number = -1; + } number += 2; // The ::{default arg#1}:: infix must be rendered before the lambda itself, |