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
(cherry picked from commit 7779a01d48
)
This commit is contained in:
parent
bf78ac7a6c
commit
8b26f50003
|
@ -164,10 +164,17 @@ static inline void handleNodeForParse( tao::pegtl::parse_tree::node& aNode,
|
||||||
|
|
||||||
for( const auto& subnode : aNode.children )
|
for( const auto& subnode : aNode.children )
|
||||||
{
|
{
|
||||||
if( subnode->is_type<SIM_VALUE_PARSER::intPart>() )
|
try
|
||||||
aParseResult.intPart = std::stol( subnode->string() );
|
{
|
||||||
else if( subnode->is_type<SIM_VALUE_PARSER::fracPart>() )
|
if( subnode->is_type<SIM_VALUE_PARSER::intPart>() )
|
||||||
aParseResult.fracPart = std::stol( subnode->string() );
|
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>() )
|
else if( aNode.is_type<SIM_VALUE_PARSER::exponent>() )
|
||||||
|
|
Loading…
Reference in New Issue