mso-test: import data has bad percentage value
found by converting tdf34406-1.odp to pptx and running officeotron on the output
INFO - Validating part "/ppt/slides/slide4.xml" using schema "29500T/pml.xsd" ...
ERROR - (slides/slide4.xml:2 col:24,296) cvc-datatype-valid.1.2.3:
'-4900000' is not a valid value of union type 'ST_PositiveFixedPercentage'.
The import data in content.xml looks like:
<style:style style:name="ce8" style:family="table-cell">
<style:graphic-properties draw:fill="solid" draw:fill-color="#808080"
draw:opacity="-4900%"
where the opacity value is wildly out of range. So validate on input.
Change-Id: I1d9146a3f38f975a5e229f63e17fca6fb435439b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194950
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 80c58f15baf79f19b954b1199cbca9c2f3dcf8bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194952
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -903,6 +903,7 @@ bool ThemeExport::writeColorSet(model::Theme const& rTheme)
|
||||
|
||||
// drawingML alpha is a percentage on a 0..100000 scale.
|
||||
sal_Int32 nAlpha = aColor.GetAlpha() * oox::drawingml::MAX_PERCENT / 255;
|
||||
assert(nAlpha >= 0);
|
||||
mpFS->singleElementNS(XML_a, XML_alpha, XML_val, OUString::number(nAlpha));
|
||||
|
||||
mpFS->endElementNS(XML_a, XML_srgbClr);
|
||||
|
||||
@@ -363,6 +363,7 @@ void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha )
|
||||
if( nAlpha < MAX_PERCENT )
|
||||
{
|
||||
mpFS->startElementNS(XML_a, XML_srgbClr, XML_val, sColor);
|
||||
assert(nAlpha >= 0);
|
||||
mpFS->singleElementNS(XML_a, XML_alpha, XML_val, OString::number(nAlpha));
|
||||
mpFS->endElementNS( XML_a, XML_srgbClr );
|
||||
|
||||
@@ -409,6 +410,7 @@ void DrawingML::WriteColor( const ::Color nColor, const Sequence< PropertyValue
|
||||
else if(nAlpha < MAX_PERCENT)
|
||||
{
|
||||
mpFS->startElementNS(XML_a, XML_srgbClr, XML_val, sColor);
|
||||
assert(nAlpha >= 0);
|
||||
mpFS->singleElementNS(XML_a, XML_alpha, XML_val, OString::number(nAlpha));
|
||||
mpFS->endElementNS(XML_a, XML_srgbClr);
|
||||
}
|
||||
@@ -427,6 +429,7 @@ void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTra
|
||||
{
|
||||
if(nToken == XML_alpha && nAlpha < MAX_PERCENT)
|
||||
{
|
||||
assert(nAlpha >= 0);
|
||||
mpFS->singleElementNS(XML_a, nToken, XML_val, OString::number(nAlpha));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -455,8 +455,14 @@ bool XMLNegPercentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue,
|
||||
{
|
||||
sal_Int32 nValue = 0;
|
||||
bool bRet = ::sax::Converter::convertPercent( nValue, rStrImpValue );
|
||||
if (bRet)
|
||||
bRet = !o3tl::checked_sub<sal_Int32>(100, nValue, nValue);
|
||||
if (!bRet)
|
||||
return false;
|
||||
if (nValue < 0 || nValue > 100)
|
||||
{
|
||||
SAL_WARN("xmloff", "Percentage property out of range, ignoring");
|
||||
return false;
|
||||
}
|
||||
bRet = !o3tl::checked_sub<sal_Int32>(100, nValue, nValue);
|
||||
if (bRet)
|
||||
lcl_xmloff_setAny( rValue, nValue, nBytes );
|
||||
return bRet;
|
||||
|
||||
Reference in New Issue
Block a user