Resolves: ofz#576 unexpected exception with invalid fraction
Change-Id: I1d653775e88e9fa2ba7b62fce39d52fc21ffe363
This commit is contained in:
@@ -129,19 +129,26 @@ void ImplWriteColor( SvStream& rOStm, const Color& rColor )
|
|||||||
rOStm.WriteInt16( nVal );
|
rOStm.WriteInt16( nVal );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode )
|
bool ImplReadMapMode(SvStream& rIStm, MapMode& rMapMode)
|
||||||
{
|
{
|
||||||
Point aOrg;
|
sal_Int16 nUnit(0);
|
||||||
sal_Int32 nXNum;
|
rIStm.ReadInt16(nUnit);
|
||||||
sal_Int32 nXDenom;
|
|
||||||
sal_Int32 nYNum;
|
Point aOrg;
|
||||||
sal_Int32 nYDenom;
|
ReadPair(rIStm, aOrg);
|
||||||
sal_Int16 nUnit;
|
|
||||||
|
sal_Int32 nXNum(0), nXDenom(0), nYNum(0), nYDenom(0);
|
||||||
|
rIStm.ReadInt32(nXNum).ReadInt32(nXDenom).ReadInt32(nYNum).ReadInt32(nYDenom);
|
||||||
|
|
||||||
|
if (!rIStm.good() || nXDenom == 0 || nYDenom == 0)
|
||||||
|
{
|
||||||
|
SAL_WARN("vcl.gdi", "Parsing error: invalid mapmode fraction");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
rIStm.ReadInt16( nUnit );
|
|
||||||
ReadPair( rIStm, aOrg );
|
|
||||||
rIStm.ReadInt32( nXNum ).ReadInt32( nXDenom ).ReadInt32( nYNum ).ReadInt32( nYDenom );
|
|
||||||
rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), Fraction( nYNum, nYDenom ) );
|
rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), Fraction( nYNum, nYDenom ) );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
|
void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
|
||||||
@@ -503,7 +510,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
|
|||||||
rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding();
|
rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding();
|
||||||
bool bFatLine = false;
|
bool bFatLine = false;
|
||||||
|
|
||||||
MapMode aMapMode;
|
|
||||||
tools::Polygon aActionPoly;
|
tools::Polygon aActionPoly;
|
||||||
Rectangle aRect;
|
Rectangle aRect;
|
||||||
Point aPt, aPt1;
|
Point aPt, aPt1;
|
||||||
@@ -513,7 +519,11 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
|
|||||||
sal_uInt32 nUnicodeCommentStreamPos = 0;
|
sal_uInt32 nUnicodeCommentStreamPos = 0;
|
||||||
sal_Int32 nUnicodeCommentActionNumber = 0;
|
sal_Int32 nUnicodeCommentActionNumber = 0;
|
||||||
|
|
||||||
ImplReadMapMode( rIStm, aMapMode ); // MapMode
|
rMtf.SetPrefSize(aPrefSz);
|
||||||
|
|
||||||
|
MapMode aMapMode;
|
||||||
|
if (ImplReadMapMode(rIStm, aMapMode)) // MapMode
|
||||||
|
rMtf.SetPrefMapMode(aMapMode);
|
||||||
|
|
||||||
sal_Int32 nActions(0);
|
sal_Int32 nActions(0);
|
||||||
rIStm.ReadInt32(nActions); // Action count
|
rIStm.ReadInt32(nActions); // Action count
|
||||||
@@ -531,8 +541,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
|
|||||||
nActions = nMaxPossibleActions;
|
nActions = nMaxPossibleActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
rMtf.SetPrefSize( aPrefSz );
|
|
||||||
rMtf.SetPrefMapMode( aMapMode );
|
|
||||||
size_t nLastPolygonAction(0);
|
size_t nLastPolygonAction(0);
|
||||||
|
|
||||||
for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
|
for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
|
||||||
@@ -1042,11 +1050,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
|
|||||||
|
|
||||||
case GDI_MAPMODE_ACTION:
|
case GDI_MAPMODE_ACTION:
|
||||||
{
|
{
|
||||||
ImplReadMapMode( rIStm, aMapMode );
|
if (ImplReadMapMode(rIStm, aMapMode))
|
||||||
rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
|
{
|
||||||
|
rMtf.AddAction(new MetaMapModeAction(aMapMode));
|
||||||
|
|
||||||
// #106172# Track font relevant data in shadow VDev
|
// #106172# Track font relevant data in shadow VDev
|
||||||
aFontVDev->SetMapMode( aMapMode );
|
aFontVDev->SetMapMode(aMapMode);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user