android.hardware.broadcastradio-service.default_fuzzer: Add signal() to handle SIGPIPE
Adding signal handler to avoid abort() due to
broken pipe.
Test: ./android.hardware.broadcastradio-service.default_fuzzer
Bug: 376201407
Change-Id: I283644ca1062737435c27d809e3961e9267e0f30
diff --git a/broadcastradio/aidl/default/fuzzer.cpp b/broadcastradio/aidl/default/fuzzer.cpp
index d535432..2492d47 100644
--- a/broadcastradio/aidl/default/fuzzer.cpp
+++ b/broadcastradio/aidl/default/fuzzer.cpp
@@ -24,6 +24,8 @@
using ::android::fuzzService;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ // TODO(b/183141167): need to rewrite 'dump' to avoid SIGPIPE.
+ signal(SIGPIPE, SIG_IGN);
const VirtualRadio& amFmRadioMock = VirtualRadio::getAmFmRadio();
std::shared_ptr<BroadcastRadio> amFmRadio =
::ndk::SharedRefBase::make<BroadcastRadio>(amFmRadioMock);