diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-04-26 10:47:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-04-26 13:58:11 +0200 |
commit | 2cb23f6ff94a7ad466cd035df2f6519a7dbd0b57 (patch) | |
tree | 059a54a7a89072794ecb0060aa2c59ecbf79443f /vcl | |
parent | a32bd25acf541168c332d18e44be3a4ab558deec (diff) |
ofz#47029 Timeout
Change-Id: I0fe3a01b237eb142b9e156fc886144f48f8ede18
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133436
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/idxf/dxf2mtf.cxx | 5 | ||||
-rw-r--r-- | vcl/source/filter/idxf/dxfentrd.cxx | 18 | ||||
-rw-r--r-- | vcl/source/filter/idxf/dxfentrd.hxx | 2 |
3 files changed, 13 insertions, 12 deletions
diff --git a/vcl/source/filter/idxf/dxf2mtf.cxx b/vcl/source/filter/idxf/dxf2mtf.cxx index c0105f4bc6da..2b26abffd38e 100644 --- a/vcl/source/filter/idxf/dxf2mtf.cxx +++ b/vcl/source/filter/idxf/dxf2mtf.cxx @@ -573,15 +573,14 @@ void DXF2GDIMetaFile::DrawLWPolyLineEntity(const DXFLWPolyLineEntity & rE, const void DXF2GDIMetaFile::DrawHatchEntity(const DXFHatchEntity & rE, const DXFTransform & rTransform ) { - if ( !rE.nBoundaryPathCount ) + if (rE.aBoundaryPathData.empty()) return; SetAreaAttribute( rE ); tools::PolyPolygon aPolyPoly; - for (sal_Int32 j = 0; j < rE.nBoundaryPathCount; ++j) + for (const DXFBoundaryPathData& rPathData : rE.aBoundaryPathData) { std::vector< Point > aPtAry; - const DXFBoundaryPathData& rPathData = rE.aBoundaryPathData[j]; if ( rPathData.bIsPolyLine ) { for (const auto& a : rPathData.aP) diff --git a/vcl/source/filter/idxf/dxfentrd.cxx b/vcl/source/filter/idxf/dxfentrd.cxx index 2582b6a15b45..ba7cae6adb76 100644 --- a/vcl/source/filter/idxf/dxfentrd.cxx +++ b/vcl/source/filter/idxf/dxfentrd.cxx @@ -645,7 +645,7 @@ DXFHatchEntity::DXFHatchEntity() : nCurrentBoundaryPathIndex( -1 ), nFlags( 0 ), nAssociativityFlag( 0 ), - nBoundaryPathCount( 0 ), + nMaxBoundaryPathCount( 0 ), nHatchStyle( 0 ), nHatchPatternType( 0 ), fHatchPatternAngle( 0.0 ), @@ -669,12 +669,12 @@ void DXFHatchEntity::EvaluateGroup( DXFGroupReader & rDGR ) case 91 : { bIsInBoundaryPathContext = true; - nBoundaryPathCount = rDGR.GetI(); + nMaxBoundaryPathCount = rDGR.GetI(); // limit alloc to max reasonable size based on remaining data in stream - if (nBoundaryPathCount > 0 && o3tl::make_unsigned(nBoundaryPathCount) <= rDGR.remainingSize()) - aBoundaryPathData.resize(nBoundaryPathCount); + if (nMaxBoundaryPathCount > 0 && o3tl::make_unsigned(nMaxBoundaryPathCount) > rDGR.remainingSize()) + aBoundaryPathData.reserve(nMaxBoundaryPathCount); else - nBoundaryPathCount = 0; + nMaxBoundaryPathCount = 0; } break; case 75 : @@ -699,9 +699,11 @@ void DXFHatchEntity::EvaluateGroup( DXFGroupReader & rDGR ) bool bExecutingGroupCode = false; if ( bIsInBoundaryPathContext ) { - if ( ( nCurrentBoundaryPathIndex >= 0 ) && - ( nCurrentBoundaryPathIndex < nBoundaryPathCount ) ) - bExecutingGroupCode = aBoundaryPathData[ nCurrentBoundaryPathIndex ].EvaluateGroup( rDGR ); + if (nCurrentBoundaryPathIndex >= 0 && nCurrentBoundaryPathIndex < nMaxBoundaryPathCount) + { + aBoundaryPathData.resize(nCurrentBoundaryPathIndex + 1); + bExecutingGroupCode = aBoundaryPathData.back().EvaluateGroup(rDGR); + } } if ( !bExecutingGroupCode ) DXFBasicEntity::EvaluateGroup(rDGR); diff --git a/vcl/source/filter/idxf/dxfentrd.hxx b/vcl/source/filter/idxf/dxfentrd.hxx index 775d6a0844cb..85dbf7dd06b1 100644 --- a/vcl/source/filter/idxf/dxfentrd.hxx +++ b/vcl/source/filter/idxf/dxfentrd.hxx @@ -429,7 +429,7 @@ class DXFHatchEntity : public DXFBasicEntity sal_Int32 nFlags; // 70 (solid fill = 1, pattern fill = 0) sal_Int32 nAssociativityFlag; // 71 (associative = 1, non-associative = 0) - sal_Int32 nBoundaryPathCount; // 91 + sal_Int32 nMaxBoundaryPathCount; // 91 sal_Int32 nHatchStyle; // 75 (odd parity = 0, outmost area = 1, entire area = 2 ) sal_Int32 nHatchPatternType; // 76 (user defined = 0, predefined = 1, custom = 2) double fHatchPatternAngle; // 52 (pattern fill only) |