binder_parcel_fuzzer: readString8Inplace
Missing coverage.
Bug: N/A
Test: run binder_parcel_fuzzer locally for a few minutes
Change-Id: I75e85189159fe7da26ba98bf0dde92bf281aa642
diff --git a/libs/binder/parcel_fuzzer/binder.cpp b/libs/binder/parcel_fuzzer/binder.cpp
index a94f06f..96cd215 100644
--- a/libs/binder/parcel_fuzzer/binder.cpp
+++ b/libs/binder/parcel_fuzzer/binder.cpp
@@ -143,6 +143,13 @@
FUZZ_LOG() << "read c-str: " << (str ? str : "<empty string>");
},
PARCEL_READ_OPT_STATUS(android::String8, readString8),
+ [] (const ::android::Parcel& p, uint8_t /*data*/) {
+ FUZZ_LOG() << "about to readString8Inplace";
+ size_t outLen = 0;
+ const char* str = p.readString8Inplace(&outLen);
+ std::string bytes = hexString(str, sizeof(char) * (outLen + 1));
+ FUZZ_LOG() << "readString8Inplace: " << bytes << " size: " << outLen;
+ },
PARCEL_READ_OPT_STATUS(android::String16, readString16),
PARCEL_READ_WITH_STATUS(std::unique_ptr<android::String16>, readString16),
PARCEL_READ_WITH_STATUS(std::optional<android::String16>, readString16),
@@ -150,8 +157,8 @@
FUZZ_LOG() << "about to readString16Inplace";
size_t outLen = 0;
const char16_t* str = p.readString16Inplace(&outLen);
- FUZZ_LOG() << "readString16Inplace: " << hexString(str, sizeof(char16_t) * outLen)
- << " size: " << outLen;
+ std::string bytes = hexString(str, sizeof(char16_t) * (outLen + 1));
+ FUZZ_LOG() << "readString16Inplace: " << bytes << " size: " << outLen;
},
PARCEL_READ_WITH_STATUS(android::sp<android::IBinder>, readStrongBinder),
PARCEL_READ_WITH_STATUS(android::sp<android::IBinder>, readNullableStrongBinder),