Kaydet (Commit) 8e5fe8dc authored tarafından Luboš Luňák's avatar Luboš Luňák

avoid infinite loop when parsing malformed ooxml math (fdo#57886)

Change-Id: I2f66bc335795a9e84f532fb28d3585aed783ebd6
üst 015bcb08
...@@ -69,7 +69,7 @@ OUString SmOoxmlImport::handleStream() ...@@ -69,7 +69,7 @@ OUString SmOoxmlImport::handleStream()
{ {
// strictly speaking, it is not OMathArg here, but currently supported // strictly speaking, it is not OMathArg here, but currently supported
// functionality is the same like OMathArg, in the future this may need improving // functionality is the same like OMathArg, in the future this may need improving
OUString item = readOMathArg(); OUString item = readOMathArg( M_TOKEN( oMath ));
if( item.isEmpty()) if( item.isEmpty())
continue; continue;
if( !ret.isEmpty()) if( !ret.isEmpty())
...@@ -87,10 +87,10 @@ OUString SmOoxmlImport::handleStream() ...@@ -87,10 +87,10 @@ OUString SmOoxmlImport::handleStream()
return ret; return ret;
} }
OUString SmOoxmlImport::readOMathArg() OUString SmOoxmlImport::readOMathArg( int stoptoken )
{ {
OUString ret; OUString ret;
while( !stream.atEnd() && stream.currentToken() != CLOSING( stream.currentToken())) while( !stream.atEnd() && stream.currentToken() != CLOSING( stoptoken ))
{ {
if( !ret.isEmpty()) if( !ret.isEmpty())
ret += " "; ret += " ";
...@@ -164,7 +164,7 @@ OUString SmOoxmlImport::readOMathArg() ...@@ -164,7 +164,7 @@ OUString SmOoxmlImport::readOMathArg()
OUString SmOoxmlImport::readOMathArgInElement( int token ) OUString SmOoxmlImport::readOMathArgInElement( int token )
{ {
stream.ensureOpeningTag( token ); stream.ensureOpeningTag( token );
OUString ret = readOMathArg(); OUString ret = readOMathArg( token );
stream.ensureClosingTag( token ); stream.ensureClosingTag( token );
return ret; return ret;
} }
......
...@@ -63,7 +63,7 @@ private: ...@@ -63,7 +63,7 @@ private:
OUString handleSsub(); OUString handleSsub();
OUString handleSsubsup(); OUString handleSsubsup();
OUString handleSsup(); OUString handleSsup();
OUString readOMathArg(); OUString readOMathArg( int stoptoken );
OUString readOMathArgInElement( int token ); OUString readOMathArgInElement( int token );
oox::formulaimport::XmlStream& stream; oox::formulaimport::XmlStream& stream;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment