[Lldb-commits] [PATCH] D123098: [lldb] Fix undefined behavior: left shift of negative value

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 4 16:20:29 PDT 2022


JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jingham, jasonmolenda.
Herald added a project: All.
JDevlieghere requested review of this revision.

Fix undefined behavior in AppleObjCRuntimeV2 where we were left shifting a signed value.

rdar://91242879


https://reviews.llvm.org/D123098

Files:
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp


Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2765,7 +2765,7 @@
       (((uint64_t)unobfuscated << m_objc_debug_taggedpointer_payload_lshift) >>
        m_objc_debug_taggedpointer_payload_rshift);
   int64_t data_payload_signed =
-      ((int64_t)((int64_t)unobfuscated
+      ((int64_t)((uint64_t)unobfuscated
                  << m_objc_debug_taggedpointer_payload_lshift) >>
        m_objc_debug_taggedpointer_payload_rshift);
   return ClassDescriptorSP(new ClassDescriptorV2Tagged(


STAMPS
actor(@JDevlieghere) application(Differential) author(@JDevlieghere) herald(H576) herald(H864) monogram(D123098) object-type(DREV) phid(PHID-DREV-vn5s2fbg65fw42dy4msc) reviewer(@aprantl) reviewer(@jasonmolenda) reviewer(@jingham) revision-status(needs-review) subscriber(@lldb-commits) tag(#all) via(web)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123098.420342.patch
Type: text/x-patch
Size: 771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220404/54691755/attachment.bin>


More information about the lldb-commits mailing list