diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-02-05 09:48:36 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-02-05 09:48:36 +0100 |
commit | 10ed6326346ea44202f75e87cce99d2aab8c7939 (patch) | |
tree | 43f456a4b063b111158617a2c8208e6b18c715f8 | |
parent | e16a07f70ac622a01e759f2a3a5be3b9e02e30ae (diff) |
Re-add "Avoid undefined out-of-bounds double -> sal_Int32 conversion"
(5abe0ab18a10a3cb13485ce3ba9433bd82b32221).
6884f53ac490c11b98a77e747033f4971cc285f5 "default B2DRange ctor doesn't do what
I thought it did" had reverted it, but the fix there is apparently not enough
yet, <http://ci.libreoffice.org/job/lo_ubsan/165/console> still fails with
> /vcl/headless/svpgdi.cxx:1274:28: runtime error: value 1.79769e+308 is outside the range of representable values of type 'int'
> #0 0x2b826285b4d3 in SvpSalGraphics::releaseCairoContext(_cairo*, bool, basegfx::B2DRange const&) const /vcl/headless/svpgdi.cxx:1274:28
> #1 0x2b8262868c3b in SvpSalGraphics::drawPolyPolygon(basegfx::B2DPolyPolygon const&) /vcl/headless/svpgdi.cxx:899:5
> #2 0x2b826286c6f6 in SvpSalGraphics::drawPolygon(unsigned int, SalPoint const*) /vcl/headless/svpgdi.cxx:551:5
> #3 0x2b826179915c in SalGraphics::DrawPolygon(unsigned int, SalPoint const*, OutputDevice const*) /vcl/source/gdi/salgdilayout.cxx:419:9
> #4 0x2b82604d6f5a in OutputDevice::DrawEllipse(Rectangle const&) /vcl/source/outdev/curvedshapes.cxx:67:13
> #5 0x2b8261f02c4d in CircType::Draw(OutputDevice&) /vcl/source/filter/sgvmain.cxx:596:13
> #6 0x2b8261f0ddc6 in DrawObjkList(SvStream&, OutputDevice&) /vcl/source/filter/sgvmain.cxx:698:100
> #7 0x2b8261f1462a in SgfFilterSDrw(SvStream&, SgfHeader&, SgfEntry&, GDIMetaFile&) /vcl/source/filter/sgvmain.cxx:820:26
> #8 0x2b8261f16726 in SgfSDrwFilter(SvStream&, GDIMetaFile&, INetURLObject const&) /vcl/source/filter/sgvmain.cxx:858:22
> #9 0x2b8261e48f33 in GraphicFilter::ImportGraphic(Graphic&, rtl::OUString const&, SvStream&, unsigned short, unsigned short*, GraphicFilterImportFlags, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>*, WMF_EXTERNALHEADER*) /vcl/source/filter/graphicfilter.cxx:1670:30
> #10 0x2b8261e3c85a in GraphicFilter::ImportGraphic(Graphic&, rtl::OUString const&, SvStream&, unsigned short, unsigned short*, GraphicFilterImportFlags, WMF_EXTERNALHEADER*) /vcl/source/filter/graphicfilter.cxx:1314:12
> #11 0x2b827bb9fee3 in VclFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) /vcl/qa/cppunit/graphicfilter/filters-test.cxx:60:12
[...]
Change-Id: Icb8f52414f57f08334fc501842b3f75c1d3642eb
-rw-r--r-- | vcl/headless/svpgdi.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index bebf53e0c3ce..9c9de7450afc 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1271,8 +1271,21 @@ cairo_user_data_key_t* SvpSalGraphics::getDamageKey() void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, const basegfx::B2DRange& rExtents) const { - sal_Int32 nExtentsLeft(rExtents.getMinX()), nExtentsTop(rExtents.getMinY()); - sal_Int32 nExtentsRight(rExtents.getMaxX()), nExtentsBottom(rExtents.getMaxY()); + sal_Int32 nExtentsLeft; + sal_Int32 nExtentsTop; + sal_Int32 nExtentsRight; + sal_Int32 nExtentsBottom; + if (rExtents.isEmpty()) { + nExtentsLeft = 0; + nExtentsTop = 0; + nExtentsRight = 0; + nExtentsBottom = 0; + } else { + nExtentsLeft = rExtents.getMinX(); + nExtentsTop = rExtents.getMinY(); + nExtentsRight = rExtents.getMaxX(); + nExtentsBottom = rExtents.getMaxY(); + } sal_Int32 nWidth = cairo_image_surface_get_width(m_pSurface); sal_Int32 nHeight = cairo_image_surface_get_height(m_pSurface); nExtentsLeft = std::max<sal_Int32>(nExtentsLeft, 0); |