From 94791c79229bdf61b8e2c93bd564e79ee317a5c5 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Tue, 16 Feb 2021 20:32:35 +0100 Subject: [PATCH] Improve exception handling in memory.grow instruction --- lib/fizzy/execute.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fizzy/execute.cpp b/lib/fizzy/execute.cpp index d89344143..910b516b9 100644 --- a/lib/fizzy/execute.cpp +++ b/lib/fizzy/execute.cpp @@ -837,10 +837,10 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, const Value* args, try { if (new_pages > instance.memory_pages_limit) - throw std::bad_alloc(); + throw std::length_error(""); memory->resize(new_pages * PageSize); } - catch (std::bad_alloc const&) + catch (const std::length_error&) { ret = static_cast(-1); }