Loading libs/binder/Parcel.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -2976,14 +2976,14 @@ status_t Parcel::restartWrite(size_t desired) return continueWrite(desired); } releaseObjects(); uint8_t* data = reallocZeroFree(mData, mDataCapacity, desired, mDeallocZero); if (!data && desired > mDataCapacity) { mError = NO_MEMORY; return NO_MEMORY; } releaseObjects(); if (data || desired == 0) { LOG_ALLOC("Parcel %p: restart from %zu to %zu capacity", this, mDataCapacity, desired); if (mDataCapacity > desired) { Loading libs/binder/tests/parcel_fuzzer/binder.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,14 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { p.setDataPosition(pos); FUZZ_LOG() << "setDataPosition done"; }, [] (const ::android::Parcel& p, FuzzedDataProvider& provider) { size_t len = provider.ConsumeIntegralInRange<size_t>(0, 1024); std::vector<uint8_t> bytes = provider.ConsumeBytes<uint8_t>(len); FUZZ_LOG() << "about to setData: " <<(bytes.data() ? HexString(bytes.data(), bytes.size()) : "null"); // TODO: allow all read and write operations (*const_cast<::android::Parcel*>(&p)).setData(bytes.data(), bytes.size()); FUZZ_LOG() << "setData done"; }, PARCEL_READ_NO_STATUS(size_t, allowFds), PARCEL_READ_NO_STATUS(size_t, hasFileDescriptors), PARCEL_READ_NO_STATUS(std::vector<android::sp<android::IBinder>>, debugReadAllStrongBinders), Loading Loading
libs/binder/Parcel.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -2976,14 +2976,14 @@ status_t Parcel::restartWrite(size_t desired) return continueWrite(desired); } releaseObjects(); uint8_t* data = reallocZeroFree(mData, mDataCapacity, desired, mDeallocZero); if (!data && desired > mDataCapacity) { mError = NO_MEMORY; return NO_MEMORY; } releaseObjects(); if (data || desired == 0) { LOG_ALLOC("Parcel %p: restart from %zu to %zu capacity", this, mDataCapacity, desired); if (mDataCapacity > desired) { Loading
libs/binder/tests/parcel_fuzzer/binder.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,14 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS { p.setDataPosition(pos); FUZZ_LOG() << "setDataPosition done"; }, [] (const ::android::Parcel& p, FuzzedDataProvider& provider) { size_t len = provider.ConsumeIntegralInRange<size_t>(0, 1024); std::vector<uint8_t> bytes = provider.ConsumeBytes<uint8_t>(len); FUZZ_LOG() << "about to setData: " <<(bytes.data() ? HexString(bytes.data(), bytes.size()) : "null"); // TODO: allow all read and write operations (*const_cast<::android::Parcel*>(&p)).setData(bytes.data(), bytes.size()); FUZZ_LOG() << "setData done"; }, PARCEL_READ_NO_STATUS(size_t, allowFds), PARCEL_READ_NO_STATUS(size_t, hasFileDescriptors), PARCEL_READ_NO_STATUS(std::vector<android::sp<android::IBinder>>, debugReadAllStrongBinders), Loading