Merge "Add bound checks to utf16_to_utf8" into nyc-mr1-dev

This commit is contained in:
Sergio Giro
2016-07-11 12:11:30 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 3 deletions

View File

@@ -57,8 +57,8 @@ aaptTests := \
aaptHostStaticLibs := \
libandroidfw \
libpng \
liblog \
libutils \
liblog \
libcutils \
libexpat \
libziparchive-host \

View File

@@ -441,8 +441,10 @@ std::string utf16ToUtf8(const StringPiece16& utf16) {
}
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);
utf16_to_utf8(utf16.data(), utf16.length(), &*utf8.begin());
return utf8;
}

View File

@@ -47,8 +47,8 @@ hostStaticLibs := \
libaapt \
libandroidfw \
libpng \
liblog \
libutils \
liblog \
libcutils \
libexpat \
libziparchive-host \