summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-08-06 01:10:08 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-08-06 01:10:08 +0000
commit50217e529f6c2c03a7a5790a3e1cd76207d8bada (patch)
tree107c6a4b0a828d6d509a0ffdced63dd88d88c72a
parent3a408db2343393a612fc6e801e714a0588745c8a (diff)
parentdf2e518ccf639daf045d99a2a76927a1d7046afd (diff)
downloadcore-android11-d1-s6-release.tar.gz
Change-Id: I8e64de75589c8128e39ebe437ef4125021595597
-rw-r--r--init/AndroidTest.xml3
-rw-r--r--libutils/String8.cpp8
2 files changed, 10 insertions, 1 deletions
diff --git a/init/AndroidTest.xml b/init/AndroidTest.xml
index 920dc6c58..95f97e3fd 100644
--- a/init/AndroidTest.xml
+++ b/init/AndroidTest.xml
@@ -29,4 +29,7 @@
<option name="module-name" value="CtsInitTestCases" />
<option name="runtime-hint" value="65s" />
</test>
+ <!-- Controller that will skip the module if a native bridge situation is detected -->
+ <!-- For example: module wants to run arm32 and device is x86 -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.NativeBridgeModuleController" />
</configuration>
diff --git a/libutils/String8.cpp b/libutils/String8.cpp
index d13548e4c..9d50e0bc5 100644
--- a/libutils/String8.cpp
+++ b/libutils/String8.cpp
@@ -322,8 +322,14 @@ status_t String8::appendFormatV(const char* fmt, va_list args)
n = vsnprintf(nullptr, 0, fmt, tmp_args);
va_end(tmp_args);
- if (n != 0) {
+ if (n < 0) return UNKNOWN_ERROR;
+
+ if (n > 0) {
size_t oldLength = length();
+ if ((size_t)n > SIZE_MAX - 1 ||
+ oldLength > SIZE_MAX - (size_t)n - 1) {
+ return NO_MEMORY;
+ }
char* buf = lockBuffer(oldLength + n);
if (buf) {
vsnprintf(buf + oldLength, n + 1, fmt, args);