diff options
author | Abseil Team <absl-team@google.com> | 2020-07-27 12:21:58 -0700 |
---|---|---|
committer | Mark Barolak <mbar@google.com> | 2020-07-27 15:43:11 -0400 |
commit | d39fe6cd6f5eb72dc741f17d3a143a6a5a56538a (patch) | |
tree | 672d9eff428aeb3623eed12138e1b1a15fa0372a /absl/debugging/internal | |
parent | 2c8a5b0d890cfbd2c1e70163e347f3e00b4ddb49 (diff) |
Export of internal Abseil changes
--
8726480d631a3736347f542dab5628d5e2ace3c1 by Mark Barolak <mbar@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 323414814
--
abc4a382a29fb857432e0e13a8c21ebe808f9828 by Abseil Team <absl-team@google.com>:
Fix buffer overflow when the result of demangling doesn't fit.
PiperOrigin-RevId: 323392968
--
7ed3e514519a971322d0a3333c7e85ed1f2a5f71 by Gennadiy Rozental <rogeeff@google.com>:
Move ABSL_DEPRECATED and ABSL_FALLTHROUGH_INTENDED from base.h into attribute.h.
PiperOrigin-RevId: 323137526
--
fc0afdb0792d565065d25feb9680972218355f90 by Xiaoyi Zhang <zhangxy@google.com>:
Add documentation for `absl::StatusCode`.
PiperOrigin-RevId: 323065623
GitOrigin-RevId: 8726480d631a3736347f542dab5628d5e2ace3c1
Change-Id: I9d39650e49ff265cd2dafee302013694e97c813f
Diffstat (limited to 'absl/debugging/internal')
-rw-r--r-- | absl/debugging/internal/demangle.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc index fc262e50..5f54ef34 100644 --- a/absl/debugging/internal/demangle.cc +++ b/absl/debugging/internal/demangle.cc @@ -409,6 +409,7 @@ static bool IsFunctionCloneSuffix(const char *str) { static bool EndsWith(State *state, const char chr) { return state->parse_state.out_cur_idx > 0 && + state->parse_state.out_cur_idx < state->out_end_idx && chr == state->out[state->parse_state.out_cur_idx - 1]; } @@ -421,8 +422,10 @@ static void MaybeAppendWithLength(State *state, const char *const str, if (str[0] == '<' && EndsWith(state, '<')) { Append(state, " ", 1); } - // Remember the last identifier name for ctors/dtors. - if (IsAlpha(str[0]) || str[0] == '_') { + // Remember the last identifier name for ctors/dtors, + // but only if we haven't yet overflown the buffer. + if (state->parse_state.out_cur_idx < state->out_end_idx && + (IsAlpha(str[0]) || str[0] == '_')) { state->parse_state.prev_name_idx = state->parse_state.out_cur_idx; state->parse_state.prev_name_length = length; } |