[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source
Caolán McNamara
caolanm at redhat.com
Fri May 27 08:25:57 UTC 2016
vcl/source/outdev/bitmap.cxx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 6fb88a0c67150a751f59ebcba5f5419b24e6f4a7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 27 09:23:03 2016 +0100
Related: tdf#87967 valgrind reported invalid reads on 1 pixel wide bitmap
Change-Id: Iddd18280c780d8b9f5e11fcc2af80749917192c4
(cherry picked from commit a9d2302d4d0732a0c1203bbb7c0182b8de59403d)
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index a3e0571..a07b32c 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -811,7 +811,7 @@ public:
const long nMapY = mpMapY[nY];
const long nMapFY = mpMapYOffset[nY];
- pLine0 = pSource->GetScanline(nMapY);
+ pLine0 = pSource->GetScanline(nMapY);
// tdf#95481 guard nMapY + 1 to be within bounds
pLine1 = (nMapY + 1 < pSource->Height()) ? pSource->GetScanline(nMapY + 1) : pLine0;
@@ -827,7 +827,7 @@ public:
const long nMapFX = mpMapXOffset[nX];
pColorSample1 = pLine0 + 3L * nMapX;
- pColorSample2 = pColorSample1 + 3L;
+ pColorSample2 = (nMapX + 1 < pSource->Width()) ? pColorSample1 + 3L : pColorSample1;
nColor1Line1 = (static_cast<long>(*pColorSample1) << 7) + nMapFX * (static_cast<long>(*pColorSample2) - *pColorSample1);
pColorSample1++;
@@ -839,7 +839,7 @@ public:
nColor3Line1 = (static_cast<long>(*pColorSample1) << 7) + nMapFX * (static_cast<long>(*pColorSample2) - *pColorSample1);
pColorSample1 = pLine1 + 3L * nMapX;
- pColorSample2 = pColorSample1 + 3L;
+ pColorSample2 = (nMapX + 1 < pSource->Width()) ? pColorSample1 + 3L : pColorSample1;
nColor1Line2 = (static_cast<long>(*pColorSample1) << 7) + nMapFX * (static_cast<long>(*pColorSample2) - *pColorSample1);
pColorSample1++;
@@ -851,11 +851,11 @@ public:
nColor3Line2 = (static_cast<long>(*pColorSample1) << 7) + nMapFX * (static_cast<long>(*pColorSample2) - *pColorSample1);
pColorSample1 = pLineAlpha0 + nMapX;
- pColorSample2 = pColorSample1 + 1L;
+ pColorSample2 = (nMapX + 1 < pSourceAlpha->Width()) ? pColorSample1 + 1L : pColorSample1;
nAlphaLine1 = (static_cast<long>(*pColorSample1) << 7) + nMapFX * (static_cast<long>(*pColorSample2) - *pColorSample1);
pColorSample1 = pLineAlpha1 + nMapX;
- pColorSample2 = pColorSample1 + 1L;
+ pColorSample2 = (nMapX + 1 < pSourceAlpha->Width()) ? pColorSample1 + 1L : pColorSample1;
nAlphaLine2 = (static_cast<long>(*pColorSample1) << 7) + nMapFX * (static_cast<long>(*pColorSample2) - *pColorSample1);
nColor1 = (nColor1Line1 + nMapFY * ((nColor1Line2 >> 7) - (nColor1Line1 >> 7))) >> 7;
More information about the Libreoffice-commits
mailing list