diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-28 09:06:02 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-11-28 14:39:56 +0100 |
commit | e3dc0612e1e75e53c0483755c6dc2d47db938c91 (patch) | |
tree | bc49ab28fb470f427445a5eb2cc62202d73c0841 /oox | |
parent | 9a110b6a284657f4db33627d8f76c270dac23810 (diff) |
ofz: ensure aCoordList has required elements
Change-Id: I6687f7e499907f2f44ade2b05b35e40570dabc6b
Reviewed-on: https://gerrit.libreoffice.org/45391
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 2cbb4ca24fca..a5d75346284d 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -311,7 +311,8 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r { switch ( state ) { - case MOVE_REL: // 2* params -> param count reset + case MOVE_REL: + aCoordList.resize(2, 0); // 2* params -> param count reset if ( rPointLists.size() > 0 && rPointLists.back().size() > 0 ) { rPointLists.push_back( ::std::vector< Point >() ); @@ -323,18 +324,20 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 2; break; - case MOVE_ABS: // 2 params -> no param count reset + case MOVE_ABS: + aCoordList.resize(2, 0); // 2 params -> no param count reset if ( rPointLists.size() > 0 && rPointLists.back().size() > 0 ) { rPointLists.push_back( ::std::vector< Point >() ); rFlagLists.push_back( ::std::vector< PolygonFlags >() ); } - rPointLists.back().push_back( Point( (aCoordList[ 0 ]), (aCoordList.size() > 1 ? aCoordList[ 1 ] : 0) ) ); + rPointLists.back().push_back( Point( (aCoordList[ 0 ]), aCoordList[ 1 ] ) ); rFlagLists.back().push_back( PolygonFlags_NORMAL ); aCurrentPoint = rPointLists.back().back(); break; - case BEZIER_REL: // 6* params -> param count reset + case BEZIER_REL: + aCoordList.resize(6, 0); // 6* params -> param count reset rPointLists.back().push_back( Point( aCurrentPoint.X + aCoordList[ 0 ], aCurrentPoint.Y + aCoordList[ 1 ] ) ); rPointLists.back().push_back( Point( aCurrentPoint.X + aCoordList[ 2 ], @@ -348,7 +351,8 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 6; break; - case BEZIER_ABS: // 6* params -> param count reset + case BEZIER_ABS: + aCoordList.resize(6, 0); // 6* params -> param count reset rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) ); rPointLists.back().push_back( Point( aCoordList[ 2 ], aCoordList[ 3 ] ) ); rPointLists.back().push_back( Point( aCoordList[ 4 ], aCoordList[ 5 ] ) ); @@ -359,7 +363,8 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 6; break; - case LINE_REL: // 2* params -> param count reset + case LINE_REL: + aCoordList.resize(2, 0); // 2* params -> param count reset rPointLists.back().push_back( Point( aCurrentPoint.X + aCoordList[ 0 ], aCurrentPoint.Y + aCoordList[ 1 ] ) ); rFlagLists.back().push_back( PolygonFlags_NORMAL ); @@ -367,8 +372,9 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 2; break; - case LINE_ABS: // 2* params -> param count reset - rPointLists.back().push_back( Point( aCoordList[ 0 ], (aCoordList.size() > 1 ? aCoordList[ 1 ] : 0) ) ); + case LINE_ABS: + aCoordList.resize(2, 0); // 2* params -> param count reset + rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) ); rFlagLists.back().push_back( PolygonFlags_NORMAL ); aCurrentPoint = rPointLists.back().back(); nParamCount = 2; |