Eeschema: fix segfault when loading malformed libraries. (fixes lp:1527804)
This commit is contained in:
committed by
Wayne Stambaugh
parent
b526227529
commit
2f7b3ab56e
@@ -886,7 +886,7 @@ bool LIB_PART::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
||||
{
|
||||
p = strtok( line, " \t\n" );
|
||||
|
||||
if( stricmp( p, "ENDDEF" ) == 0 )
|
||||
if( p && stricmp( p, "ENDDEF" ) == 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -948,6 +948,9 @@ bool LIB_PART::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
||||
if( *line == '#' ) // a comment
|
||||
continue;
|
||||
|
||||
if( p == NULL ) // empty line
|
||||
continue;
|
||||
|
||||
if( line[0] == 'T' && line[1] == 'i' )
|
||||
result = LoadDateAndTime( aLineReader );
|
||||
else if( *line == 'F' )
|
||||
@@ -1036,7 +1039,12 @@ bool LIB_PART::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorMsg )
|
||||
break;
|
||||
|
||||
case '#': // Comment
|
||||
continue;
|
||||
continue;
|
||||
|
||||
case '\n':
|
||||
case '\r':
|
||||
case 0: // empty line
|
||||
continue;
|
||||
|
||||
default:
|
||||
aErrorMsg.Printf( wxT( "undefined DRAW command %c" ), line[0] );
|
||||
|
||||
Reference in New Issue
Block a user