[llvm] 8eea478 - [ItaniumDemangle] reject A-F in FP literals (#83061)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 27 22:34:11 PST 2024
Author: Ryan Prichard
Date: 2024-02-27T22:34:07-08:00
New Revision: 8eea478f57e79b6fad065d023355907bc2098206
URL: https://github.com/llvm/llvm-project/commit/8eea478f57e79b6fad065d023355907bc2098206
DIFF: https://github.com/llvm/llvm-project/commit/8eea478f57e79b6fad065d023355907bc2098206.diff
LOG: [ItaniumDemangle] reject A-F in FP literals (#83061)
Sync this change to the copy of ItaniumDemangle.h in "llvm":
https://github.com/llvm/llvm-project/pull/82864
The Itanium C++ ABI specifies that FP literals are encoded using a
lowercase hexadecimal string. Previously, libc++abi allowed uppercase
A-F characters but decoded them by subtracting 'a' from them, producing
negative digit values. It is especially confusing to accept an 'E' digit
because 'E' marks the end of the FP literal.
Added:
Modified:
llvm/include/llvm/Demangle/ItaniumDemangle.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index 04bc58d8f63e47..d33af157543fec 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -5540,7 +5540,7 @@ Node *AbstractManglingParser<Alloc, Derived>::parseFloatingLiteral() {
return nullptr;
std::string_view Data(First, N);
for (char C : Data)
- if (!std::isxdigit(C))
+ if (!(C >= '0' && C <= '9') && !(C >= 'a' && C <= 'f'))
return nullptr;
First += N;
if (!consumeIf('E'))
More information about the llvm-commits
mailing list