crashtesting: crash on loading moz330387-6.svg

Change-Id: I9bba4cd9332320285c06ca3ba8eaf94ab89dfeef
This commit is contained in:
Caolán McNamara
2016-02-09 09:56:43 +00:00
parent 9ae891280a
commit 3d42c1fc15

View File

@@ -348,29 +348,32 @@ struct AnnotatingVisitor
} }
case XML_STOP: case XML_STOP:
{ {
const sal_Int32 nNumAttrs( xAttributes->getLength() ); if (!maGradientVector.empty())
maGradientStopVector.push_back(GradientStop());
maGradientVector.back().maStops.push_back(maGradientStopVector.size()-1);
// first parse 'color' as 'stop-color' might depend on it
// if 'stop-color''s value is "currentColor" and parsed previously
uno::Reference<xml::dom::XNode> xNodeColor(xAttributes->getNamedItem("color"));
if(xNodeColor.is())
parseGradientStop( maGradientStopVector.back(),
maGradientStopVector.size()-1,
XML_STOP_COLOR,
xNodeColor->getNodeValue() );
//now, parse the rest of attributes
for( sal_Int32 i=0; i<nNumAttrs; ++i )
{ {
const sal_Int32 nTokenId( const sal_Int32 nNumAttrs( xAttributes->getLength() );
getTokenId(xAttributes->item(i)->getNodeName())); maGradientStopVector.push_back(GradientStop());
if ( nTokenId != XML_COLOR ) maGradientVector.back().maStops.push_back(maGradientStopVector.size()-1);
// first parse 'color' as 'stop-color' might depend on it
// if 'stop-color''s value is "currentColor" and parsed previously
uno::Reference<xml::dom::XNode> xNodeColor(xAttributes->getNamedItem("color"));
if(xNodeColor.is())
parseGradientStop( maGradientStopVector.back(), parseGradientStop( maGradientStopVector.back(),
maGradientStopVector.size()-1, maGradientStopVector.size()-1,
nTokenId, XML_STOP_COLOR,
xAttributes->item(i)->getNodeValue() ); xNodeColor->getNodeValue() );
//now, parse the rest of attributes
for( sal_Int32 i=0; i<nNumAttrs; ++i )
{
const sal_Int32 nTokenId(
getTokenId(xAttributes->item(i)->getNodeName()));
if ( nTokenId != XML_COLOR )
parseGradientStop( maGradientStopVector.back(),
maGradientStopVector.size()-1,
nTokenId,
xAttributes->item(i)->getNodeValue() );
}
} }
break; break;
} }