diff options
| author | 2020-11-18 00:06:05 +0000 | |
|---|---|---|
| committer | 2020-11-18 00:08:37 +0000 | |
| commit | 35cb62d0937bc43d58d16138044398ea7f9737db (patch) | |
| tree | 954b1ac4cad8ffc4138ccc376fac7a4384c4ad9f /libs | |
| parent | 143c9c57fab3db9d0e38d79f05dce5864ae7cd00 (diff) | |
binder_parcel_fuzzer: readString8Inplace
Missing coverage.
Bug: N/A
Test: run binder_parcel_fuzzer locally for a few minutes
Change-Id: I75e85189159fe7da26ba98bf0dde92bf281aa642
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/binder/parcel_fuzzer/binder.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/binder/parcel_fuzzer/binder.cpp b/libs/binder/parcel_fuzzer/binder.cpp index a94f06fa85..96cd215d93 100644 --- a/libs/binder/parcel_fuzzer/binder.cpp +++ b/libs/binder/parcel_fuzzer/binder.cpp @@ -143,6 +143,13 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { 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 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { 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), |