summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author Sergio Giro <sgiro@google.com> 2016-08-02 18:48:17 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-08-02 18:48:19 +0000
commite55e65c9933ec6bb205768155ce44fa1d7dabf3e (patch)
tree30f81a644eafb624571099eeadee4a2a509cc322 /tools
parente212afa0f84969ce92eab48db65733b53baef5f8 (diff)
parent03b95c7df5fb577fa6e4c133dcdbc85c880d86b4 (diff)
Merge "Unicode: specify destination length in utf8_to_utf16 methods"
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt2/util/Util.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/aapt2/util/Util.cpp b/tools/aapt2/util/Util.cpp
index 3c0e9bdeab0d..e743247be8a9 100644
--- a/tools/aapt2/util/Util.cpp
+++ b/tools/aapt2/util/Util.cpp
@@ -434,7 +434,11 @@ std::u16string utf8ToUtf16(const StringPiece& utf8) {
std::u16string utf16;
utf16.resize(utf16Length);
- utf8_to_utf16(reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length(), &*utf16.begin());
+ utf8_to_utf16(
+ reinterpret_cast<const uint8_t*>(utf8.data()),
+ utf8.length(),
+ &*utf16.begin(),
+ (size_t) utf16Length + 1);
return utf16;
}