libbinder: readString*Inplace SafetyNet (II) am: 61d0f84881

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/13170519

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id2945a9d2f2acc742ce7817b309948cafdd0d377
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 1f7d27e..b7ad660 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1869,8 +1869,11 @@
     if (size >= 0 && size < INT32_MAX) {
         *outLen = size;
         const char* str = (const char*)readInplace(size+1);
-        if (str != nullptr && str[size] == '\0') {
-            return str;
+        if (str != nullptr) {
+            if (str[size] == '\0') {
+                return str;
+            }
+            android_errorWriteLog(0x534e4554, "172655291");
         }
     }
     *outLen = 0;
@@ -1929,8 +1932,11 @@
     if (size >= 0 && size < INT32_MAX) {
         *outLen = size;
         const char16_t* str = (const char16_t*)readInplace((size+1)*sizeof(char16_t));
-        if (str != nullptr && str[size] == u'\0') {
-            return str;
+        if (str != nullptr) {
+            if (str[size] == u'\0') {
+                return str;
+            }
+            android_errorWriteLog(0x534e4554, "172655291");
         }
     }
     *outLen = 0;