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

Commit 60762093 authored by Steven Moreland's avatar Steven Moreland
Browse files

binder_rpc_fuzzer: avoid SIGPIPE

android::base::WriteFully was causing SIGPIPE to be sent when we hang up
connections after the last fuzzer modification.

Bug: N/A
Test: binder_rpc_fuzzer for a few minutes

Change-Id: I3fe20da26805134bb28284860116ca766d823b3f
parent 3ca69777
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/unique_fd.h>
#include <binder/Binder.h>
@@ -90,8 +89,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
            if (provider.ConsumeBool()) {
                std::vector<uint8_t> writeData = provider.ConsumeBytes<uint8_t>(
                        provider.ConsumeIntegralInRange<size_t>(0, provider.remaining_bytes()));
                CHECK(base::WriteFully(connections.at(idx).get(), writeData.data(),
                                       writeData.size()));
                ssize_t size = TEMP_FAILURE_RETRY(send(connections.at(idx).get(), writeData.data(),
                                                       writeData.size(), MSG_NOSIGNAL));
                CHECK(errno == EPIPE || size == writeData.size())
                        << size << " " << writeData.size() << " " << strerror(errno);
            } else {
                connections.erase(connections.begin() + idx); // hang up
            }