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

Commit 8ef7fbdb authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Supplement fuzzer with testcase for ParcelableHolder and related NDK API" am: 049abe04

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1464442

Change-Id: Ib046e3ef6c94bdc625a5e0124039f370a4fbed58
parents 11bead39 049abe04
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@
#include "binder_ndk.h"
#include "binder_ndk.h"


#include <android/binder_parcel_utils.h>
#include <android/binder_parcel_utils.h>
#include <android/binder_parcelable_utils.h>


#include "util.h"
#include "util.h"


@@ -54,6 +55,25 @@ std::vector<ParcelRead<NdkParcelAdapter>> BINDER_NDK_PARCEL_READ_FUNCTIONS{
            binder_status_t status = AParcel_readStatusHeader(p.aParcel(), t.getR());
            binder_status_t status = AParcel_readStatusHeader(p.aParcel(), t.getR());
            FUZZ_LOG() << "read status header: " << status;
            FUZZ_LOG() << "read status header: " << status;
        },
        },
        [](const NdkParcelAdapter& p, uint8_t /*data*/) {
            FUZZ_LOG() << "about to getDataSize the parcel";
            AParcel_getDataSize(p.aParcel());
            FUZZ_LOG() << "getDataSize done";
        },
        [](const NdkParcelAdapter& p, uint8_t data) {
            FUZZ_LOG() << "about to read a ParcelableHolder";
            ndk::AParcelableHolder ph {(data % 2 == 1) ? ndk::STABILITY_LOCAL : ndk::STABILITY_VINTF};
            binder_status_t status = AParcel_readParcelable(p.aParcel(), &ph);
            FUZZ_LOG() << "read the ParcelableHolder: " << status;
        },
        [](const NdkParcelAdapter& p, uint8_t data) {
            FUZZ_LOG() << "about to appendFrom";
            AParcel* parcel = AParcel_create();
            binder_status_t status = AParcel_appendFrom(p.aParcel(), parcel, 0, data);
            AParcel_delete(parcel);
            FUZZ_LOG() << "appendFrom: " << status;
        },

        PARCEL_READ(int32_t, AParcel_readInt32),
        PARCEL_READ(int32_t, AParcel_readInt32),
        PARCEL_READ(uint32_t, AParcel_readUint32),
        PARCEL_READ(uint32_t, AParcel_readUint32),
        PARCEL_READ(int64_t, AParcel_readInt64),
        PARCEL_READ(int64_t, AParcel_readInt64),