Add some safety checks to Excellon number format detection

Fixes: lp:1754121
* https://bugs.launchpad.net/kicad/+bug/1754121
This commit is contained in:
Jon Evans 2018-03-21 22:29:37 -04:00
parent 4152069504
commit a931ac436a
1 changed files with 11 additions and 0 deletions

View File

@ -559,6 +559,13 @@ bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
while( IsNumber( *read ) )
{
if( *read == '.' )
{
integer = nbdigits;
read++;
continue;
}
if( ( *read >= '0' ) && ( *read <='9' ) )
nbdigits++;
@ -567,6 +574,10 @@ bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
mantissa = nbdigits - integer;
// Enforce minimum mantissa of 3 for metric
if( m_GerbMetric && mantissa < 3 )
mantissa = 3;
m_FmtScale.x = m_FmtScale.y = mantissa;
m_FmtLen.x = m_FmtLen.y = integer + mantissa;