From 7ecb57f7adbea2928aa468ad2aecf05b10725ad4 Mon Sep 17 00:00:00 2001 From: Katara Date: Tue, 27 Oct 2026 14:04:55 +0100 Subject: [PATCH] rpc : catch std::length_error in recv_msg (#31204) --- ggml/src/ggml-rpc/ggml-rpc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-rpc/ggml-rpc.cpp b/ggml/src/ggml-rpc/ggml-rpc.cpp index 49f11073e..8cedee7ed 100644 --- a/ggml/src/ggml-rpc/ggml-rpc.cpp +++ b/ggml/src/ggml-rpc/ggml-rpc.cpp @@ -348,7 +348,10 @@ static bool recv_msg(socket_ptr sock, std::vector & input) { } try { input.resize(size); - } catch (const std::bad_alloc & e) { + } catch (const std::length_error &) { + LOG_ERROR("Failed to allocate input buffer of size %" PRIu64 "\n", size); + return false; + } catch (const std::bad_alloc &) { LOG_ERROR("Failed to allocate input buffer of size %" PRIu64 "\n", size); return false; }