Skip to content

Commit d9e4955

Browse files
authoredMar 18, 2025
Abseil LTS Branch, Jan 2025, Patch 1 (#1857)
-- Fix buffer overflow the internal demangling function The overflow can happen during rollback after a parsing failure, where the null terminator is written without verifying the buffer bounds. Credit to www.code-intelligence.com for reporting this issue PiperOrigin-RevId: 732995553 Change-Id: Ic5075f53e510d270e1784d593defcd53f9121d02 -- Actually use the hint space instruction to strip PAC bits for return addresses in stack traces as the comment says https://android.googlesource.com/platform/libcore/+/71f2c75111e87091616f0f3b86bea6c4d345dad1/src/hotspot/os_cpu/linux_aarch64/pauth_linux_aarch64.inline.hpp PiperOrigin-RevId: 724360415 Change-Id: I691160e43354131a04919765ce283e07c3c933a9
1 parent 9ac7062 commit d9e4955

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed
 

‎MODULE.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
module(
1818
name = "abseil-cpp",
19-
version = "20250127.0",
19+
version = "20250127.1",
2020
compatibility_level = 1,
2121
)
2222

‎absl/base/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
// LTS releases can be obtained from
119119
// https://github.com/abseil/abseil-cpp/releases.
120120
#define ABSL_LTS_RELEASE_VERSION 20250127
121-
#define ABSL_LTS_RELEASE_PATCH_LEVEL 0
121+
#define ABSL_LTS_RELEASE_PATCH_LEVEL 1
122122

123123
// Helper macro to convert a CPP variable to a string literal.
124124
#define ABSL_INTERNAL_DO_TOKEN_STR(x) #x

‎absl/debugging/internal/demangle.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -2816,7 +2816,8 @@ static bool ParseLocalNameSuffix(State *state) {
28162816
// On late parse failure, roll back not only the input but also the output,
28172817
// whose trailing NUL was overwritten.
28182818
state->parse_state = copy;
2819-
if (state->parse_state.append) {
2819+
if (state->parse_state.append &&
2820+
state->parse_state.out_cur_idx < state->out_end_idx) {
28202821
state->out[state->parse_state.out_cur_idx] = '\0';
28212822
}
28222823
return false;
@@ -2829,7 +2830,8 @@ static bool ParseLocalNameSuffix(State *state) {
28292830
return true;
28302831
}
28312832
state->parse_state = copy;
2832-
if (state->parse_state.append) {
2833+
if (state->parse_state.append &&
2834+
state->parse_state.out_cur_idx < state->out_end_idx) {
28332835
state->out[state->parse_state.out_cur_idx] = '\0';
28342836
}
28352837

‎absl/debugging/internal/demangle_test.cc

+7
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,13 @@ TEST(DemangleRegression, DeeplyNestedArrayType) {
20172017
TestOnInput(data.c_str());
20182018
}
20192019

2020+
TEST(DemangleRegression, ShortOutputBuffer) {
2021+
// This should not crash.
2022+
char buffer[1];
2023+
EXPECT_FALSE(
2024+
absl::debugging_internal::Demangle("_ZZ2wwE", buffer, sizeof(buffer)));
2025+
}
2026+
20202027
struct Base {
20212028
virtual ~Base() = default;
20222029
};

‎absl/debugging/internal/stacktrace_aarch64-inl.inc

+3-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ inline void* ClearPacBits(void* ptr) {
188188
// compatibility with ARM platforms that do not support pointer
189189
// authentication, we use the hint space instruction XPACLRI instead. Hint
190190
// space instructions behave as NOPs on unsupported platforms.
191-
asm("xpaclri" : "+r"(x30));
191+
#define ABSL_XPACLRI_HINT "hint #0x7;"
192+
asm(ABSL_XPACLRI_HINT : "+r"(x30)); // asm("xpaclri" : "+r"(x30));
193+
#undef ABSL_XPACLRI_HINT
192194
return x30;
193195
}
194196

0 commit comments

Comments
 (0)
Please sign in to comment.