From a6b60694f65f91431d0faf59ca7c9db0d3fc6002 Mon Sep 17 00:00:00 2001 From: goatpig Date: Wed, 8 Sep 2021 08:25:46 +0200 Subject: [PATCH] catch multisig deser throw --- cppForSwig/BtcUtils.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cppForSwig/BtcUtils.h b/cppForSwig/BtcUtils.h index a4013ace9..3e6998ba0 100644 --- a/cppForSwig/BtcUtils.h +++ b/cppForSwig/BtcUtils.h @@ -1190,7 +1190,17 @@ class BtcUtils if( nextSz != 0x41 && nextSz != 0x21 ) return 0; - pkList[i] = brr.get_BinaryDataRef(nextSz); + try + { + pkList[i] = brr.get_BinaryDataRef(nextSz); + } + catch (const std::exception& e) + { + LOGERR << "Failed to decode pub keys for multisig script," << + " with error: " << e.what(); + LOGERR << script.toHexStr(); + return 0; + } } return M;