From 02a3462cf41ba8c6b7bc2b60f424d1969b1acb5f Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Thu, 5 Sep 2019 14:12:13 +0200 Subject: [PATCH] Don't crash in decode_calldata for FATE --- src/aeb_fate_abi.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aeb_fate_abi.erl b/src/aeb_fate_abi.erl index a7e89dd..6bbc7ad 100644 --- a/src/aeb_fate_abi.erl +++ b/src/aeb_fate_abi.erl @@ -37,9 +37,11 @@ create_calldata(FunName, Args) -> -spec decode_calldata(list(), binary()) -> {ok, term()} | {error, term()}. decode_calldata(FunName, Calldata) -> FunctionId = aeb_fate_code:symbol_identifier(list_to_binary(FunName)), - case ?FATE_TUPLE_ELEMENTS(aeb_fate_encoding:deserialize(Calldata)) of + try ?FATE_TUPLE_ELEMENTS(aeb_fate_encoding:deserialize(Calldata)) of [FunctionId, FateArgs] -> {ok, ?FATE_TUPLE_ELEMENTS(FateArgs)}; _ -> {error, decode_error} + catch _:_ -> + {error, decode_error} end. -spec get_function_name_from_function_hash(binary(), aeb_fate_code:fcode()) ->