summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2014-03-31 14:37:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-04-01 09:28:58 +0100
commitcc1a7748c867716966b6a38e75f89df5d92ee104 (patch)
tree9a8666a437751cb0914a607a18219528af07386a /vcl/source/gdi
parent994da4b9738dafdc0654a439a40adfe4c02a507d (diff)
Resolves: #i124555# restore stream position after Seek to end of stream
(cherry picked from commit 61efddf5ab8cd318e022ca1ac817ba0879a55e23) Conflicts: vcl/source/gdi/dibtools.cxx Change-Id: Ie6c0aeab5988b68954a0bdd460317ac9539d8a5f
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/dibtools.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 1ffdcd908279..5d71a46ffe7f 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -766,17 +766,18 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon
bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset )
{
- sal_uInt32 nTmp32;
- sal_uInt16 nTmp16 = 0;
- bool bRet = false;
+ bool bRet = false;
- const sal_uLong nStreamLength (rIStm.Seek(STREAM_SEEK_TO_END));
- rIStm.Seek(STREAM_SEEK_TO_BEGIN);
+ const sal_uInt64 nSavedStreamPos( rIStm.Tell() );
+ const sal_uInt64 nStreamLength( rIStm.Seek( STREAM_SEEK_TO_END ) );
+ rIStm.Seek( nSavedStreamPos );
+ sal_uInt16 nTmp16 = 0;
rIStm.ReadUInt16( nTmp16 );
if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
{
+ sal_uInt32 nTmp32(0);
if ( 0x4142 == nTmp16 )
{
rIStm.SeekRel( 12L );
@@ -794,7 +795,7 @@ bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset )
bRet = ( rIStm.GetError() == 0UL );
}
- if (rOffset >= nStreamLength)
+ if ( rOffset >= nStreamLength )
{
// Offset claims that image starts past the end of the
// stream. Unlikely.