-
Notifications
You must be signed in to change notification settings - Fork 342
Guard against unsigned overflow. #4093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guard against unsigned overflow. #4093
Conversation
@swift-ci test |
@@ -233,6 +233,7 @@ bool LLDBMemoryReader::readBytes(swift::remote::RemoteAddress address, | |||
if (m_local_buffer) { | |||
auto addr = address.getAddressData(); | |||
if (addr >= *m_local_buffer && | |||
addr < *m_local_buffer + m_local_buffer_size && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for other reviewers, this is the non-formatting change
@swift-ci test linux |
@swift-ci test Linux |
Context: I've seen this crash on an Apple Silicon machine today — I'm sure the root cause is something else, but this check still is wrong. |
Note |
@swift-ci test |
If addr+size overflows (for example because addr is LLDB_INVALID_ADDRESS) then this check still succeeds because addr+size will be <= m_local_buffer + m_local_buffer_size).
@swift-ci test |
@swift-ci test linux |
If addr+size overflows (for example because addr is
LLDB_INVALID_ADDRESS) then this check still succeeds because addr+size
will be <= m_local_buffer + m_local_buffer_size).