Add bound checks to utf16_to_utf8 am: bce11021b2 am: 008120497b
am: bab3334226
Change-Id: I6e4e399dfcf89f46d40a162c77462b889883f569
This commit is contained in:
@@ -63,8 +63,8 @@ aaptHostLdLibs :=
|
|||||||
aaptHostStaticLibs := \
|
aaptHostStaticLibs := \
|
||||||
libandroidfw \
|
libandroidfw \
|
||||||
libpng \
|
libpng \
|
||||||
liblog \
|
|
||||||
libutils \
|
libutils \
|
||||||
|
liblog \
|
||||||
libcutils \
|
libcutils \
|
||||||
libexpat \
|
libexpat \
|
||||||
libziparchive-host \
|
libziparchive-host \
|
||||||
|
|||||||
@@ -303,8 +303,10 @@ std::string utf16ToUtf8(const StringPiece16& utf16) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string utf8;
|
std::string utf8;
|
||||||
|
// Make room for '\0' explicitly.
|
||||||
|
utf8.resize(utf8Length + 1);
|
||||||
|
utf16_to_utf8(utf16.data(), utf16.length(), &*utf8.begin(), utf8Length + 1);
|
||||||
utf8.resize(utf8Length);
|
utf8.resize(utf8Length);
|
||||||
utf16_to_utf8(utf16.data(), utf16.length(), &*utf8.begin());
|
|
||||||
return utf8;
|
return utf8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ hostStaticLibs := \
|
|||||||
libaapt \
|
libaapt \
|
||||||
libandroidfw \
|
libandroidfw \
|
||||||
libpng \
|
libpng \
|
||||||
liblog \
|
|
||||||
libutils \
|
libutils \
|
||||||
|
liblog \
|
||||||
libcutils \
|
libcutils \
|
||||||
libexpat \
|
libexpat \
|
||||||
libziparchive-host \
|
libziparchive-host \
|
||||||
|
|||||||
Reference in New Issue
Block a user