From 4c7ee4ac3bd7be5272dc59b7ea58430e62084a3c Mon Sep 17 00:00:00 2001 From: Zephyron Date: Wed, 22 Oct 2025 20:47:24 +1000 Subject: [PATCH] fix: BSD socket assertion failure in PollImpl Initialize PollFD.revents field to prevent assertion failures when copying from read buffer. The assertion was failing because revents contained uninitialized data from the buffer. Thanks to Dr.Stug for providing the logs that identified this issue. Fixes assertion failure at core\hle\service\sockets\bsd.cpp:564 Signed-off-by: Zephyron --- src/core/hle/service/sockets/bsd.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 15e8f7d85..f443124ec 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -546,6 +546,11 @@ std::pair BSD::PollImpl(std::vector& write_buffer, std::span fds(nfds); std::memcpy(fds.data(), read_buffer.data(), nfds * sizeof(PollFD)); + // Initialize revents to zero to ensure clean state + for (PollFD& pollfd : fds) { + pollfd.revents = PollEvents{}; + } + if (timeout >= 0) { const s64 seconds = timeout / 1000; const u64 nanoseconds = 1'000'000 * (static_cast(timeout) % 1000);