[PATCH] D149061: [clang] remove dereferencing of invalid pointer
Ashay Rane via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 08:37:30 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGff2e6199b235: [clang] remove dereferencing of invalid pointer (authored by ashay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149061/new/
https://reviews.llvm.org/D149061
Files:
llvm/include/llvm/Demangle/ItaniumDemangle.h
Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -2330,17 +2330,14 @@
template<typename Fn> void match(Fn F) const { F(Contents); }
void printLeft(OutputBuffer &OB) const override {
- const char *first = &*Contents.begin();
- const char *last = &*Contents.end() + 1;
-
const size_t N = FloatData<Float>::mangled_size;
- if (static_cast<std::size_t>(last - first) > N) {
- last = first + N;
+ if (Contents.size() >= N) {
union {
Float value;
char buf[sizeof(Float)];
};
- const char *t = first;
+ const char *t = &*Contents.begin();
+ const char *last = t + N;
char *e = buf;
for (; t != last; ++t, ++e) {
unsigned d1 = isdigit(*t) ? static_cast<unsigned>(*t - '0')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149061.516420.patch
Type: text/x-patch
Size: 937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230424/f36c7a8e/attachment.bin>
More information about the llvm-commits
mailing list