summaryrefslogtreecommitdiff
path: root/libutils/String8.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-07-13 23:31:45 +0000
committerSteven Moreland <smoreland@google.com>2020-07-13 23:33:25 +0000
commitfdbc565dd5a4ce68303dc6d9eeef2f2c9387bd0f (patch)
treea4a09197cc30b7036fbdd5793f640f8eca377b25 /libutils/String8.cpp
parentc8e4154d899847a32f0fb7bbf999c39c7cb0dba7 (diff)
String8: explicit int -> char cast.
Since tolower/toupper take and return integer arguments, ascii chars in the extended range will be converted from positive int values to negative char values. In order to silence an error here, which was added recently with integer sanitization here, casting explicitly. Fixes: 160831549 Test: w/ libutils_fuzz_string8 Change-Id: Iedcd6643f95f84ce662a80e38931d918a200f508
Diffstat (limited to 'libutils/String8.cpp')
-rw-r--r--libutils/String8.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libutils/String8.cpp b/libutils/String8.cpp
index d00e39c56..c83789145 100644
--- a/libutils/String8.cpp
+++ b/libutils/String8.cpp
@@ -424,7 +424,7 @@ void String8::toLower(size_t start, size_t length)
char* buf = lockBuffer(len);
buf += start;
while (length > 0) {
- *buf = tolower(*buf);
+ *buf = static_cast<char>(tolower(*buf));
buf++;
length--;
}
@@ -448,7 +448,7 @@ void String8::toUpper(size_t start, size_t length)
char* buf = lockBuffer(len);
buf += start;
while (length > 0) {
- *buf = toupper(*buf);
+ *buf = static_cast<char>(toupper(*buf));
buf++;
length--;
}