diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-02-02 18:19:54 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-02-02 18:19:54 +0100 |
commit | 5abe0ab18a10a3cb13485ce3ba9433bd82b32221 (patch) | |
tree | fbe4257dfab5446dfc1ec557c9243c333ca62746 | |
parent | 1d478d5b7ee71d991e6bb8b20cc0178ffec1d2e6 (diff) |
Avoid undefined out-of-bounds double -> sal_Int32 conversion
...upon empty rExtents, during "make Gallery_txtshapes"
Change-Id: Ie482041828b7abcf13d0efb5da62d1158b7f5e92
-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 c72efcaa6401..edd230dcf674 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); |