summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2015-11-09 14:00:50 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2015-11-11 09:31:00 +0000
commit5a86268e5dabaa5c02cf912e3793ce0f44c03a0b (patch)
tree438111e8f895104af63db8393f9b4f884f02f966
parent4759ba7062b2f77e18984dde9869b514c8cb48a4 (diff)
tdf#95481 catch out-of-range access in vcl bitmap
blendBitmap24 assumes bitmap is 2 lines high for doing interpolation. For bitmaps of height 1, really nothing to interpolate there. Fix cornercase by 'blending' between the very same line instead. Reviewed-on: https://gerrit.libreoffice.org/19863 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Cherry-picked from 99e3ab6effa9356a1a444160e60ed8df099b15a3 Change-Id: I9b94000aa563e525d0bb2418346ad2c86af26df8 Reviewed-on: https://gerrit.libreoffice.org/19888 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r--vcl/source/outdev/bitmap.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 2ae0236518a3..3f415d458878 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -807,11 +807,13 @@ public:
const long nMapY = mpMapY[nY];
const long nMapFY = mpMapYOffset[nY];
- pLine0 = pSource->GetScanline(nMapY);
- pLine1 = pSource->GetScanline(nMapY + 1);
+ pLine0 = pSource->GetScanline(nMapY);
+ // tdf#95481 guard nMapY + 1 to be within bounds
+ pLine1 = (nMapY + 1 < pSource->Height()) ? pSource->GetScanline(nMapY + 1) : pLine0;
pLineAlpha0 = pSourceAlpha->GetScanline(nMapY);
- pLineAlpha1 = pSourceAlpha->GetScanline(nMapY + 1);
+ // tdf#95481 guard nMapY + 1 to be within bounds
+ pLineAlpha1 = (nMapY + 1 < pSourceAlpha->Height()) ? pSourceAlpha->GetScanline(nMapY + 1) : pLineAlpha0;
pDestScanline = pDestination->GetScanline(nY);