From 03b95c7df5fb577fa6e4c133dcdbc85c880d86b4 Mon Sep 17 00:00:00 2001 From: Sergio Giro Date: Thu, 21 Jul 2016 14:44:07 +0100 Subject: Unicode: specify destination length in utf8_to_utf16 methods Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3 --- tools/aapt2/util/Util.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools') 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(utf8.data()), utf8.length(), &*utf16.begin()); + utf8_to_utf16( + reinterpret_cast(utf8.data()), + utf8.length(), + &*utf16.begin(), + (size_t) utf16Length + 1); return utf16; } -- cgit v1.2.3-59-g8ed1b