Snap for 6740034 from 3a7a8b871aae47ead363e6493a01d2e26bc2a2f3 to rvc-qpr1-release
Change-Id: I98c24de2587e1cb21224dc81699b82d1e8689608
diff --git a/init/AndroidTest.xml b/init/AndroidTest.xml
index 920dc6c..95f97e3 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 d13548e..9d50e0b 100644
--- a/libutils/String8.cpp
+++ b/libutils/String8.cpp
@@ -322,8 +322,14 @@
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);