From a27befe456b8c9cb95bd922ea9a2613cfb473009 Mon Sep 17 00:00:00 2001 From: mailwl Date: Fri, 22 Jun 2018 11:18:23 +0300 Subject: IPC: skip empty buffer write prevent yuzu crash, if games, like Axiom Verge, trying to read 0 bytes from file --- src/core/hle/kernel/hle_ipc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 01904467e..b0d83f401 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -271,6 +271,11 @@ std::vector HLERequestContext::ReadBuffer(int buffer_index) const { } size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const { + if (size == 0) { + NGLOG_WARNING(Core, "skip empty buffer write"); + return 0; + } + const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; const size_t buffer_size{GetWriteBufferSize(buffer_index)}; if (size > buffer_size) { -- cgit v1.2.3