diff options
author | Sergio Giro <sgiro@google.com> | 2015-08-18 14:44:54 +0100 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2015-09-08 13:36:51 -0700 |
commit | 2040543eb353f545be4e2b25b637bd82ae66cb32 (patch) | |
tree | d67a42c4c32f8daa75473e24051847a5dc84bf99 | |
parent | 5490545f92617660959be202d1be10b45aebd133 (diff) | |
download | core-2040543eb353f545be4e2b25b637bd82ae66cb32.tar.gz |
libutils: fix overflow in String8::allocFromUTF8android-cts-5.1_r3android-5.1.1_r24android-5.1.1_r20android-5.1.1_r19
Patch contributed in:
https://code.google.com/p/android/issues/detail?id=182908
Bug: 23290056
(cherry picked from commit 4eeacbeec0ae66e9d9395abbf83666709f2e11e3)
Change-Id: Ife1dc0791040150132bea6884f1e6c8d31972d1b
(cherry picked from commit ebabef275283f771151ec93c17469374b789b2c8)
-rw-r--r-- | libutils/String8.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libutils/String8.cpp b/libutils/String8.cpp index 40fa40ba2..d4f5c7892 100644 --- a/libutils/String8.cpp +++ b/libutils/String8.cpp @@ -81,6 +81,9 @@ void terminate_string8() static char* allocFromUTF8(const char* in, size_t len) { if (len > 0) { + if (len == SIZE_MAX) { + return NULL; + } SharedBuffer* buf = SharedBuffer::alloc(len+1); ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { |