diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 18:34:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-16 09:11:41 +0200 |
commit | 059f07f9f33460c809a93e0fda1165f5c6f6d805 (patch) | |
tree | 09bbd8b4daab16e8752b3bcf6e2d3b6602bb801a /filter | |
parent | tdf#132097: fix Find Previous with direction columns crashes in specific case (diff) | |
download | core-059f07f9f33460c809a93e0fda1165f5c6f6d805.tar.gz core-059f07f9f33460c809a93e0fda1165f5c6f6d805.zip |
fixes for code creating reversed Rectangles
ie. where left > right or top > bottom
These are all places where the code is self-evidently doing the wrong
thing.
Found by adding asserts to tools::Rectangle. In theory, this is legit,
and code that wants a proper Rectangle is supposed to be first call
Justify on a Rectangle, but lots of places don't do that, and that seems
very dodgy to me.
So lets work towards Rectangles always being in a valid state.
Change-Id: I03296a624bd9b5b193e6aa8778addfb09708cdc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92310
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/ipict/ipict.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 58ec7423de8f..d494543fb1b4 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -454,6 +454,13 @@ void PictReader::ReadRectangle(tools::Rectangle & rRect) aTopLeft=ReadPoint(); aBottomRight=ReadPoint(); + if (aTopLeft.X() > aBottomRight.X() || aTopLeft.Y() > aBottomRight.Y()) + { + SAL_WARN("filter.pict", "broken rectangle"); + pPict->SetError( SVSTREAM_FILEFORMAT_ERROR ); + rRect = tools::Rectangle(); + return; + } rRect=tools::Rectangle(aTopLeft,aBottomRight); SAL_INFO("filter.pict", "ReadRectangle: " << rRect); |