SIM_VALUE stores significants in 64-bit

stol isn't neccesarily 64-bit though, so we use stoll and catch the
overflow if we have bad input data

Fixes KICAD-2EF
This commit is contained in:
Seth Hillbrand 2023-06-29 09:48:04 -07:00
parent 5b42348834
commit 7779a01d48
1 changed files with 11 additions and 4 deletions

View File

@ -164,10 +164,17 @@ static inline void handleNodeForParse( tao::pegtl::parse_tree::node& aNode,
for( const auto& subnode : aNode.children )
{
if( subnode->is_type<SIM_VALUE_PARSER::intPart>() )
aParseResult.intPart = std::stol( subnode->string() );
else if( subnode->is_type<SIM_VALUE_PARSER::fracPart>() )
aParseResult.fracPart = std::stol( subnode->string() );
try
{
if( subnode->is_type<SIM_VALUE_PARSER::intPart>() )
aParseResult.intPart = std::stoll( subnode->string() );
else if( subnode->is_type<SIM_VALUE_PARSER::fracPart>() )
aParseResult.fracPart = std::stoll( subnode->string() );
}
catch( const std::exception& )
{
aParseResult.isOk = false;
}
}
}
else if( aNode.is_type<SIM_VALUE_PARSER::exponent>() )