diff options
| author | 2020-10-12 21:57:11 +0000 | |
|---|---|---|
| committer | 2020-10-12 21:57:11 +0000 | |
| commit | 79ce21afee467ac83d7d9ee3a449c78cb329032d (patch) | |
| tree | aecfc8fb8f29655374c1237312c66c69a0e89d16 /libs | |
| parent | a10d43275ebdd7affdd665c87b01297d6f479ea2 (diff) | |
| parent | 4aec9746deb5e6fece0c4416bcbe72244fb8294d (diff) | |
Merge "binder_parcel_fuzzer: add read* for std::optional" am: 4aec9746de
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1457558
Change-Id: I316a5d3286fd5a4c8de7b8eabcecffca0f5ef950
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/binder/parcel_fuzzer/binder.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/binder/parcel_fuzzer/binder.cpp b/libs/binder/parcel_fuzzer/binder.cpp index c2d4a3f66a..e5c6333b79 100644 --- a/libs/binder/parcel_fuzzer/binder.cpp +++ b/libs/binder/parcel_fuzzer/binder.cpp @@ -137,6 +137,7 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { PARCEL_READ_WITH_STATUS(std::string, readUtf8FromUtf16), PARCEL_READ_WITH_STATUS(std::unique_ptr<std::string>, readUtf8FromUtf16), + PARCEL_READ_WITH_STATUS(std::optional<std::string>, readUtf8FromUtf16), [] (const ::android::Parcel& p, uint8_t /*data*/) { FUZZ_LOG() << "about to read c-str"; const char* str = p.readCString(); @@ -145,6 +146,7 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { PARCEL_READ_OPT_STATUS(android::String8, readString8), 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), [] (const ::android::Parcel& p, uint8_t /*data*/) { FUZZ_LOG() << "about to readString16Inplace"; size_t outLen = 0; @@ -158,17 +160,22 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { // TODO(b/131868573): can force read of arbitrarily sized vector // PARCEL_READ_WITH_STATUS(std::vector<ByteEnum>, readEnumVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<ByteEnum>>, readEnumVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<ByteEnum>>, readEnumVector), // PARCEL_READ_WITH_STATUS(std::vector<IntEnum>, readEnumVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<IntEnum>>, readEnumVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<IntEnum>>, readEnumVector), // PARCEL_READ_WITH_STATUS(std::vector<LongEnum>, readEnumVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<LongEnum>>, readEnumVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<LongEnum>>, readEnumVector), // only reading one parcelable type for now // TODO(b/131868573): can force read of arbitrarily sized vector // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<std::unique_ptr<ExampleParcelable>>>, readParcelableVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<std::optional<ExampleParcelable>>>, readParcelableVector), // PARCEL_READ_WITH_STATUS(std::vector<ExampleParcelable>, readParcelableVector), PARCEL_READ_WITH_STATUS(ExampleParcelable, readParcelable), PARCEL_READ_WITH_STATUS(std::unique_ptr<ExampleParcelable>, readParcelable), + PARCEL_READ_WITH_STATUS(std::optional<ExampleParcelable>, readParcelable), // only reading one binder type for now PARCEL_READ_WITH_STATUS(android::sp<android::os::IServiceManager>, readStrongBinder), @@ -176,30 +183,42 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { // TODO(b/131868573): can force read of arbitrarily sized vector // PARCEL_READ_WITH_STATUS(::std::unique_ptr<std::vector<android::sp<android::IBinder>>>, readStrongBinderVector), + // PARCEL_READ_WITH_STATUS(::std::optional<std::vector<android::sp<android::IBinder>>>, readStrongBinderVector), // PARCEL_READ_WITH_STATUS(std::vector<android::sp<android::IBinder>>, readStrongBinderVector), // TODO(b/131868573): can force read of arbitrarily sized vector // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<int8_t>>, readByteVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<int8_t>>, readByteVector), // PARCEL_READ_WITH_STATUS(std::vector<int8_t>, readByteVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<uint8_t>>, readByteVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<uint8_t>>, readByteVector), // PARCEL_READ_WITH_STATUS(std::vector<uint8_t>, readByteVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<int32_t>>, readInt32Vector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<int32_t>>, readInt32Vector), // PARCEL_READ_WITH_STATUS(std::vector<int32_t>, readInt32Vector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<int64_t>>, readInt64Vector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<int64_t>>, readInt64Vector), // PARCEL_READ_WITH_STATUS(std::vector<int64_t>, readInt64Vector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<uint64_t>>, readUint64Vector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<uint64_t>>, readUint64Vector), // PARCEL_READ_WITH_STATUS(std::vector<uint64_t>, readUint64Vector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<float>>, readFloatVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<float>>, readFloatVector), // PARCEL_READ_WITH_STATUS(std::vector<float>, readFloatVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<double>>, readDoubleVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<double>>, readDoubleVector), // PARCEL_READ_WITH_STATUS(std::vector<double>, readDoubleVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<bool>>, readBoolVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<bool>>, readBoolVector), // PARCEL_READ_WITH_STATUS(std::vector<bool>, readBoolVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<char16_t>>, readCharVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<char16_t>>, readCharVector), // PARCEL_READ_WITH_STATUS(std::vector<char16_t>, readCharVector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<std::unique_ptr<android::String16>>>, readString16Vector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<std::optional<android::String16>>>, readString16Vector), // PARCEL_READ_WITH_STATUS(std::vector<android::String16>, readString16Vector), // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<std::unique_ptr<std::string>>>, readUtf8VectorFromUtf16Vector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<std::optional<std::string>>>, readUtf8VectorFromUtf16Vector), // PARCEL_READ_WITH_STATUS(std::vector<std::string>, readUtf8VectorFromUtf16Vector), [] (const android::Parcel& p, uint8_t /*len*/) { @@ -236,6 +255,7 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { // TODO(b/131868573): can force read of arbitrarily sized vector // PARCEL_READ_WITH_STATUS(std::unique_ptr<std::vector<android::base::unique_fd>>, readUniqueFileDescriptorVector), + // PARCEL_READ_WITH_STATUS(std::optional<std::vector<android::base::unique_fd>>, readUniqueFileDescriptorVector), // PARCEL_READ_WITH_STATUS(std::vector<android::base::unique_fd>, readUniqueFileDescriptorVector), [] (const android::Parcel& p, uint8_t len) { |