From 97343f3d77b896046de2e0819558d48f55642a65 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 27 Apr 2018 15:18:28 +0300 Subject: [PATCH] Handle MoMdepth overflow --- src/komodo_ccdata.h | 2 ++ src/rpcblockchain.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_ccdata.h b/src/komodo_ccdata.h index 70e601946..058e38cee 100644 --- a/src/komodo_ccdata.h +++ b/src/komodo_ccdata.h @@ -45,6 +45,8 @@ bits256 iguana_merkle(bits256 *tree,int32_t txn_count) uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth) { static uint256 zero; bits256 MoM,*tree; CBlockIndex *pindex; int32_t i; + if ( MoMdepth >= height ) + return(zero); tree = (bits256 *)calloc(MoMdepth * 3,sizeof(*tree)); for (i=0; i= height ) throw runtime_error("calc_MoM illegal height or MoMdepth\n"); //fprintf(stderr,"height_MoM height.%d\n",height); MoM = komodo_calcMoM(height,MoMdepth);