diff options
| author | 2021-05-27 02:08:32 +0000 | |
|---|---|---|
| committer | 2021-05-27 02:16:40 +0000 | |
| commit | 60762093b7530f31aa55cb1e30a82e7da3d15758 (patch) | |
| tree | 00976beadef9e965fa4a906fed992f8d3e8f2424 /libs | |
| parent | 3ca69777c5e0d96c8c95f102e41db429dc957445 (diff) | |
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
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/binder/tests/rpc_fuzzer/main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/binder/tests/rpc_fuzzer/main.cpp b/libs/binder/tests/rpc_fuzzer/main.cpp index 072f8ddd07..9fc496f460 100644 --- a/libs/binder/tests/rpc_fuzzer/main.cpp +++ b/libs/binder/tests/rpc_fuzzer/main.cpp @@ -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 } |