diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-19 09:32:40 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-08-19 14:59:23 +0200 |
commit | 9343551f5588ffa4916e2c5d33cbd6fcf56ca99d (patch) | |
tree | dba36d02c2dec3ecd2e42826be7d5e71e660d471 /svx/source/svdraw | |
parent | 5e891c2ee82f2d7566ddb4e15b9c03cecb9fc1f8 (diff) |
ofz#37370 Null-dereference
since...
commit 5b025285b3528910a4360899abb2bbbaadc72c97
Date: Wed Aug 18 07:35:05 2021 +0200
Simplify Rect2Poly
where tools::Polygon from tools::Rectangle ctor has special handling
for an 'empty' Rectangle
Change-Id: Ifb93efeee4c2c1fe1f9fe5422e0e648ad91da77a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120702
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r-- | svx/source/svdraw/svdotxtr.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index e499a332400c..0b667f18ce0c 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -239,20 +239,21 @@ void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2) std::abs(rRef1.X()-rRef2.X())==std::abs(rRef1.Y()-rRef2.Y()))) { bRotate90=maGeo.nRotationAngle.get() % 9000 ==0; } - tools::Polygon aPol(Rect2Poly(maRect,maGeo)); - sal_uInt16 i; - sal_uInt16 nPointCount=aPol.GetSize(); - for (i=0; i<nPointCount; i++) { - MirrorPoint(aPol[i],rRef1,rRef2); + if (!maRect.IsEmpty()) { // ofz#37370 an 'empty' rect creates a polygon with 0 points + tools::Polygon aPol(Rect2Poly(maRect,maGeo)); + sal_uInt16 nPointCount = aPol.GetSize(); + for (sal_uInt16 i = 0; i < nPointCount; ++i) { + MirrorPoint(aPol[i],rRef1,rRef2); + } + // turn polygon and move it a little + tools::Polygon aPol0(aPol); + aPol[0]=aPol0[1]; + aPol[1]=aPol0[0]; + aPol[2]=aPol0[3]; + aPol[3]=aPol0[2]; + aPol[4]=aPol0[1]; + Poly2Rect(aPol,maRect,maGeo); } - // turn polygon and move it a little - tools::Polygon aPol0(aPol); - aPol[0]=aPol0[1]; - aPol[1]=aPol0[0]; - aPol[2]=aPol0[3]; - aPol[3]=aPol0[2]; - aPol[4]=aPol0[1]; - Poly2Rect(aPol,maRect,maGeo); if (bRotate90) { bool bRota90=maGeo.nRotationAngle.get() % 9000 ==0; |