[all-commits] [llvm/llvm-project] c7d947: [lldb] [ObjC runtime] Don't cast to signed when le...
Jason Molenda via All-commits
all-commits at lists.llvm.org
Wed Mar 27 13:59:57 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c7d947f5e6c966bdba4db26097c3b433fcbe7841
https://github.com/llvm/llvm-project/commit/c7d947f5e6c966bdba4db26097c3b433fcbe7841
Author: Jason Molenda <jmolenda at apple.com>
Date: 2024-03-27 (Wed, 27 Mar 2024)
Changed paths:
M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
Log Message:
-----------
[lldb] [ObjC runtime] Don't cast to signed when left shifting (#86605)
This is fixing a report from ubsan which I don't think is super high
value, but our testsuite hits it on
TestDataFormatterObjCNSContainer.py so I'd like to work around it. We
are getting
```
runtime error: left shift of negative value -8827055269646171913
3159 int64_t data_payload_signed =
3160 ((int64_t)((int64_t)unobfuscated
-> 3161 << m_objc_debug_taggedpointer_ext_payload_lshift) >>
3162 m_objc_debug_taggedpointer_ext_payload_rshift);
```
At this point `unobfuscated` is 0x85800000000000f7 and
`m_objc_debug_taggedpointer_ext_payload_lshift` is 9, so
`(int64_t)0x85800000000000f7<<9` shifts off the "sign" bit and then some
zeroes etc, and that's how we get this error.
We're only trying to extract some bits in the middle of the doubleword,
so the fact that we're "losing" the sign is not a bug. Change the inner
cast to (uint64_t).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list