cbook created this revision.
Prevent negative chars from being sign-extended into isprint and isspace which
take and int and crash if the int is negative.
https://reviews.llvm.org/D36620
Files:
source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -815,7 +815,8 @@
// checksum
if (m_bytes[0] == '$' && total_length > 4) {
for (size_t i = 0; !binary && i < total_length; ++i) {
- if (isprint(m_bytes[i]) == 0 && isspace(m_bytes[i]) == 0) {
+ unsigned char c = m_bytes[i];
+ if (isprint(c) == 0 && isspace(c) == 0) {
binary = true;
}
}
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -815,7 +815,8 @@
// checksum
if (m_bytes[0] == '$' && total_length > 4) {
for (size_t i = 0; !binary && i < total_length; ++i) {
- if (isprint(m_bytes[i]) == 0 && isspace(m_bytes[i]) == 0) {
+ unsigned char c = m_bytes[i];
+ if (isprint(c) == 0 && isspace(c) == 0) {
binary = true;
}
}
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits