Fix infinite loop bug in new schematic file format image parser.

Fixes https://gitlab.com/kicad/code/kicad/issues/4362
This commit is contained in:
Wayne Stambaugh 2020-05-09 14:20:04 -04:00
parent ee08baca03
commit a81286d9ea
1 changed files with 5 additions and 0 deletions

View File

@ -2170,12 +2170,17 @@ SCH_BITMAP* SCH_SEXPR_PARSER::parseImage()
wxString data;
// Reserve 128K because most image files are going to be larger than the default
// 1K that wxString reserves.
data.reserve( 2^17 );
while( token != T_RIGHT )
{
if( !IsSymbol( token ) )
Expecting( "base64 image data" );
data += FromUTF8();
token = NextTok();
}
wxMemoryBuffer buffer = wxBase64Decode( data );