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:
parent
ee08baca03
commit
a81286d9ea
|
@ -2170,12 +2170,17 @@ SCH_BITMAP* SCH_SEXPR_PARSER::parseImage()
|
||||||
|
|
||||||
wxString data;
|
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 )
|
while( token != T_RIGHT )
|
||||||
{
|
{
|
||||||
if( !IsSymbol( token ) )
|
if( !IsSymbol( token ) )
|
||||||
Expecting( "base64 image data" );
|
Expecting( "base64 image data" );
|
||||||
|
|
||||||
data += FromUTF8();
|
data += FromUTF8();
|
||||||
|
token = NextTok();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryBuffer buffer = wxBase64Decode( data );
|
wxMemoryBuffer buffer = wxBase64Decode( data );
|
||||||
|
|
Loading…
Reference in New Issue