binder_parcel_fuzzer: reduce host/device differences
Before, the host code had certain cases disabled b/c ProcessState abrt
when /dev/binder is unavailable. However, it turns out in several
placess, ProcessState is still reachable (e.g. unflattenBinder). So,
instead, now, on host, the abort is just removed (and failures will
happen only when host tries to invoke binder later).
Bug: 142543448
Test: run binder_parcel_fuzzer for a few minutes
Change-Id: I0a322d3191be3aee630f735986064d502016c05d
diff --git a/libs/binder/fuzzer/binder.cpp b/libs/binder/fuzzer/binder.cpp
index 86264db..04fe0e7 100644
--- a/libs/binder/fuzzer/binder.cpp
+++ b/libs/binder/fuzzer/binder.cpp
@@ -93,26 +93,16 @@
PARCEL_READ_NO_STATUS(size_t, allowFds),
PARCEL_READ_NO_STATUS(size_t, hasFileDescriptors),
[] (const ::android::Parcel& p, uint8_t len) {
-#ifdef __ANDROID__
std::string interface(len, 'a');
FUZZ_LOG() << "about to enforceInterface: " << interface;
bool b = p.enforceInterface(::android::String16(interface.c_str()));
FUZZ_LOG() << "enforced interface: " << b;
-#else
- FUZZ_LOG() << "skipping enforceInterface";
- (void)p;
- (void)len;
-#endif // __ANDROID__
},
[] (const ::android::Parcel& p, uint8_t /*len*/) {
-#ifdef __ANDROID__
FUZZ_LOG() << "about to checkInterface";
- bool b = p.checkInterface(new android::BBinder());
+ android::sp<android::IBinder> aBinder = new android::BBinder();
+ bool b = p.checkInterface(aBinder.get());
FUZZ_LOG() << "checked interface: " << b;
-#else
- FUZZ_LOG() << "skipping checkInterface";
- (void)p;
-#endif // __ANDROID__
},
PARCEL_READ_NO_STATUS(size_t, objectsCount),
PARCEL_READ_NO_STATUS(status_t, errorCheck),