Abseil LTS branch, Jan 2026, Patch 1 (#2007)
* Fix sign-extension issue in absl::HexStringToBytes()
* Restrict MSVC CRC32 intrinsics to x64.
diff --git a/MODULE.bazel b/MODULE.bazel
index 5345095..7f542c9 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -16,7 +16,7 @@
module(
name = "abseil-cpp",
- version = "20260107.0",
+ version = "20260107.1",
compatibility_level = 1,
)
diff --git a/absl/base/config.h b/absl/base/config.h
index 1db9da9..4f155e2 100644
--- a/absl/base/config.h
+++ b/absl/base/config.h
@@ -118,7 +118,7 @@
// LTS releases can be obtained from
// https://github.com/abseil/abseil-cpp/releases.
#define ABSL_LTS_RELEASE_VERSION 20260107
-#define ABSL_LTS_RELEASE_PATCH_LEVEL 0
+#define ABSL_LTS_RELEASE_PATCH_LEVEL 1
// Helper macro to convert a CPP variable to a string literal.
#define ABSL_INTERNAL_DO_TOKEN_STR(x) #x
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h
index 37bd39d..8b0f94a 100644
--- a/absl/hash/internal/hash.h
+++ b/absl/hash/internal/hash.h
@@ -104,7 +104,10 @@
#define ABSL_HASH_INTERNAL_CRC32_U32 _mm_crc32_u32
#define ABSL_HASH_INTERNAL_CRC32_U8 _mm_crc32_u8
-#elif defined(_MSC_VER) && !defined(__clang__) && defined(__AVX__)
+// 32-bit builds with AVX do not have _mm_crc32_u64, so the _M_X64 condition is
+// necessary.
+#elif defined(_MSC_VER) && !defined(__clang__) && defined(__AVX__) && \
+ defined(_M_X64)
// MSVC AVX (/arch:AVX) implies SSE 4.2.
#include <intrin.h>
diff --git a/absl/strings/escaping.cc b/absl/strings/escaping.cc
index 2f8cbc1..228e527 100644
--- a/absl/strings/escaping.cc
+++ b/absl/strings/escaping.cc
@@ -827,7 +827,7 @@
}
/* clang-format off */
-constexpr std::array<char, 256> kHexValueLenient = {
+constexpr std::array<uint8_t, 256> kHexValueLenient = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -846,7 +846,7 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-constexpr std::array<signed char, 256> kHexValueStrict = {
+constexpr std::array<int8_t, 256> kHexValueStrict = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -874,7 +874,7 @@
size_t num) {
for (size_t i = 0; i < num; i++) {
to[i] = static_cast<char>(kHexValueLenient[from[i * 2] & 0xFF] << 4) +
- (kHexValueLenient[from[i * 2 + 1] & 0xFF]);
+ static_cast<char>(kHexValueLenient[from[i * 2 + 1] & 0xFF]);
}
}
@@ -992,8 +992,10 @@
output, num_bytes, [hex](char* buf, size_t buf_size) {
auto hex_p = hex.cbegin();
for (size_t i = 0; i < buf_size; ++i) {
- int h1 = absl::kHexValueStrict[static_cast<size_t>(*hex_p++)];
- int h2 = absl::kHexValueStrict[static_cast<size_t>(*hex_p++)];
+ int h1 = absl::kHexValueStrict[static_cast<size_t>(
+ static_cast<uint8_t>(*hex_p++))];
+ int h2 = absl::kHexValueStrict[static_cast<size_t>(
+ static_cast<uint8_t>(*hex_p++))];
if (h1 == -1 || h2 == -1) {
return size_t{0};
}
diff --git a/absl/strings/escaping_test.cc b/absl/strings/escaping_test.cc
index 4786c88..08618aa 100644
--- a/absl/strings/escaping_test.cc
+++ b/absl/strings/escaping_test.cc
@@ -733,6 +733,10 @@
bytes = "abc";
EXPECT_TRUE(absl::HexStringToBytes("", &bytes));
EXPECT_EQ("", bytes); // Results in empty output.
+
+ // Ensure there is no sign extension bug on a signed char.
+ hex.assign("\xC8" "b", 2);
+ EXPECT_FALSE(absl::HexStringToBytes(hex, &bytes));
}
TEST(HexAndBack, HexStringToBytes_and_BytesToHexString) {