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; }