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

Commit 822199a8 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "binder_rpc_fuzzer: avoid SIGPIPE" am: c32a92fb

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

Change-Id: I986fbd5bbfe0bc85800068a76ee1eae615a99e81
parents 68431357 c32a92fb
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
            }