Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35cb62d0 authored by Steven Moreland's avatar Steven Moreland
Browse files

binder_parcel_fuzzer: readString8Inplace

Missing coverage.

Bug: N/A
Test: run binder_parcel_fuzzer locally for a few minutes

Change-Id: I75e85189159fe7da26ba98bf0dde92bf281aa642
parent 143c9c57
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -143,6 +143,13 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS {
        FUZZ_LOG() << "read c-str: " << (str ? str : "<empty string>");
        FUZZ_LOG() << "read c-str: " << (str ? str : "<empty string>");
    },
    },
    PARCEL_READ_OPT_STATUS(android::String8, readString8),
    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_OPT_STATUS(android::String16, readString16),
    PARCEL_READ_WITH_STATUS(std::unique_ptr<android::String16>, readString16),
    PARCEL_READ_WITH_STATUS(std::unique_ptr<android::String16>, readString16),
    PARCEL_READ_WITH_STATUS(std::optional<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";
        FUZZ_LOG() << "about to readString16Inplace";
        size_t outLen = 0;
        size_t outLen = 0;
        const char16_t* str = p.readString16Inplace(&outLen);
        const char16_t* str = p.readString16Inplace(&outLen);
        FUZZ_LOG() << "readString16Inplace: " << hexString(str, sizeof(char16_t) * outLen)
        std::string bytes = hexString(str, sizeof(char16_t) * (outLen + 1));
                   << " size: " << outLen;
        FUZZ_LOG() << "readString16Inplace: " << bytes << " size: " << outLen;
    },
    },
    PARCEL_READ_WITH_STATUS(android::sp<android::IBinder>, readStrongBinder),
    PARCEL_READ_WITH_STATUS(android::sp<android::IBinder>, readStrongBinder),
    PARCEL_READ_WITH_STATUS(android::sp<android::IBinder>, readNullableStrongBinder),
    PARCEL_READ_WITH_STATUS(android::sp<android::IBinder>, readNullableStrongBinder),