You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that VERISOL will throw an exception "VeriSol translation error: Object reference not set to an instance of an object." when my solidity code contain the to.call.value(amount)("");.
Cause
In the function TranslateCallStatement (Sources/SolToBoogie/ProcedureTranslator.cs), the parameter outParams may be null. However, This code BoogieIdentifierExpr tmpVarExpr = outParams[0]; will call directly outParams[0] without judging whether the outParams is null.
privatevoidTranslateCallStatement(FunctionCallnode,List<BoogieIdentifierExpr>outParams=null){VeriSolAssert(outParams==null||outParams.Count==2,"Number of outPArams for call statement should be 2");// only handle call.value(x).gas(y)("") vararg0=node.Arguments[0].ToString();if(!string.IsNullOrEmpty(arg0)&&!arg0.Equals("\'\'")){currentStmtList.AddStatement(newBoogieSkipCmd(node.ToString()));VeriSolAssert(false,"low-level call statements with non-empty signature not implemented..");}// almost identical to send(amount)BoogieIdentifierExprtmpVarExpr=outParams[0];//bool part of the tupleif(tmpVarExpr==null){tmpVarExpr=MkNewLocalVariableWithType(BoogieType.Bool);}varamountExpr=node.MsgValue!=null?TranslateExpr(node.MsgValue):newBoogieLiteralExpr(BigInteger.Zero);TranslateSendCallStmt(node,tmpVarExpr,amountExpr,true);currentExpr=tmpVarExpr;}
So, before the BoogieIdentifierExpr tmpVarExpr = outParams[0];, we need to judge wether outParams is null. The Fixed code as follow:
privatevoidTranslateCallStatement(FunctionCallnode,List<BoogieIdentifierExpr>outParams=null){VeriSolAssert(outParams==null||outParams.Count==2,"Number of outPArams for call statement should be 2");// only handle call.value(x).gas(y)("") vararg0=node.Arguments[0].ToString();if(!string.IsNullOrEmpty(arg0)&&!arg0.Equals("\'\'")){currentStmtList.AddStatement(newBoogieSkipCmd(node.ToString()));VeriSolAssert(false,"low-level call statements with non-empty signature not implemented..");}BoogieIdentifierExprtmpVarExpr;if(null==outParams){tmpVarExpr=MkNewLocalVariableWithType(BoogieType.Bool);}else{// almost identical to send(amount)tmpVarExpr=outParams[0];//bool part of the tupleif(null==tmpVarExpr){tmpVarExpr=MkNewLocalVariableWithType(BoogieType.Bool);}}varamountExpr=node.MsgValue!=null?TranslateExpr(node.MsgValue):newBoogieLiteralExpr(BigInteger.Zero);TranslateSendCallStmt(node,tmpVarExpr,amountExpr,true);currentExpr=tmpVarExpr;}
The text was updated successfully, but these errors were encountered:
Problem
I found that VERISOL will throw an exception "VeriSol translation error: Object reference not set to an instance of an object." when my solidity code contain the to.call.value(amount)("");.
Cause
In the function TranslateCallStatement (Sources/SolToBoogie/ProcedureTranslator.cs), the parameter outParams may be null. However, This code BoogieIdentifierExpr tmpVarExpr = outParams[0]; will call directly outParams[0] without judging whether the outParams is null.
So, before the BoogieIdentifierExpr tmpVarExpr = outParams[0];, we need to judge wether outParams is null. The Fixed code as follow:
The text was updated successfully, but these errors were encountered: