[Libreoffice-commits] core.git: vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Jan 8 03:22:40 PST 2015
vcl/source/gdi/dibtools.cxx | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
New commits:
commit 350824178333b58948dbc3826ad759f10b0f026e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jan 8 10:33:51 2015 +0000
valgrind, zero out the trailing unused alignment bytes
as seen with fdo55736-1.docx
Change-Id: Ie1dec06282a600e600f606a3b4ddd814613b0108
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index d226edc..3f940af 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -1102,17 +1102,18 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess*
const long nWidth(rAcc.Width());
const long nHeight(rAcc.Height());
boost::scoped_array<sal_uInt8> pBuf(new sal_uInt8[ nAlignedWidth ]);
- sal_uInt8* pTmp(0);
- sal_uInt8 cTmp(0);
-
switch( nBitCount )
{
case( 1 ):
{
+ //valgrind, zero out the trailing unused alignment bytes
+ size_t nUnusedBytes = nAlignedWidth - ((nWidth+7) / 8);
+ memset(pBuf.get() + nAlignedWidth - nUnusedBytes, 0, nUnusedBytes);
+
for( long nY = nHeight - 1; nY >= 0L; nY-- )
{
- pTmp = pBuf.get();
- cTmp = 0;
+ sal_uInt8* pTmp = pBuf.get();
+ sal_uInt8 cTmp = 0;
for( long nX = 0L, nShift = 8L; nX < nWidth; nX++ )
{
@@ -1134,10 +1135,14 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess*
case( 4 ):
{
+ //valgrind, zero out the trailing unused alignment bytes
+ size_t nUnusedBytes = nAlignedWidth - ((nWidth+1) / 2);
+ memset(pBuf.get() + nAlignedWidth - nUnusedBytes, 0, nUnusedBytes);
+
for( long nY = nHeight - 1; nY >= 0L; nY-- )
{
- pTmp = pBuf.get();
- cTmp = 0;
+ sal_uInt8* pTmp = pBuf.get();
+ sal_uInt8 cTmp = 0;
for( long nX = 0L, nShift = 2L; nX < nWidth; nX++ )
{
@@ -1160,7 +1165,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess*
{
for( long nY = nHeight - 1; nY >= 0L; nY-- )
{
- pTmp = pBuf.get();
+ sal_uInt8* pTmp = pBuf.get();
for( long nX = 0L; nX < nWidth; nX++ )
*pTmp++ = rAcc.GetPixelIndex( nY, nX );
@@ -1180,7 +1185,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess*
for( long nY = nHeight - 1; nY >= 0L; nY-- )
{
- pTmp = pBuf.get();
+ sal_uInt8* pTmp = pBuf.get();
for( long nX = 0L; nX < nWidth; nX++ )
{
More information about the Libreoffice-commits
mailing list