Kaydet (Commit) c9952738 authored tarafından Caolán McNamara's avatar Caolán McNamara

MemoryByteGrabber sequence has to exist for Grabber lifetime

it just takes a c++ ref, so a temp is an unsuitable arg

Change-Id: I40490e94d977df91b985bc4ae458b68ee85d5dfe
Reviewed-on: https://gerrit.libreoffice.org/49321Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d4e1802c
...@@ -902,7 +902,7 @@ sal_Int32 ZipFile::readCEN() ...@@ -902,7 +902,7 @@ sal_Int32 ZipFile::readCEN()
if ( static_cast < sal_Int64 > ( nCenLen ) != nRead ) if ( static_cast < sal_Int64 > ( nCenLen ) != nRead )
throw ZipException ("Error reading CEN into memory buffer!" ); throw ZipException ("Error reading CEN into memory buffer!" );
MemoryByteGrabber aMemGrabber ( aCENBuffer ); MemoryByteGrabber aMemGrabber(aCENBuffer);
ZipEntry aEntry; ZipEntry aEntry;
sal_Int16 nCommentLen; sal_Int16 nCommentLen;
...@@ -1015,7 +1015,8 @@ void ZipFile::recover() ...@@ -1015,7 +1015,8 @@ void ZipFile::recover()
if ( nPos < nBufSize - 30 && pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 3 && pBuffer[nPos+3] == 4 ) if ( nPos < nBufSize - 30 && pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 3 && pBuffer[nPos+3] == 4 )
{ {
ZipEntry aEntry; ZipEntry aEntry;
MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( &(pBuffer[nPos+4]), 26 ) ); Sequence<sal_Int8> aTmpBuffer(&(pBuffer[nPos+4]), 26);
MemoryByteGrabber aMemGrabber(aTmpBuffer);
aEntry.nVersion = aMemGrabber.ReadInt16(); aEntry.nVersion = aMemGrabber.ReadInt16();
if ( ( aEntry.nVersion & 1 ) != 1 ) if ( ( aEntry.nVersion & 1 ) != 1 )
...@@ -1084,7 +1085,8 @@ void ZipFile::recover() ...@@ -1084,7 +1085,8 @@ void ZipFile::recover()
else if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 7 && pBuffer[nPos+3] == 8 ) else if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 7 && pBuffer[nPos+3] == 8 )
{ {
sal_Int64 nCompressedSize, nSize; sal_Int64 nCompressedSize, nSize;
MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( &(pBuffer[nPos+4]), 12 ) ); Sequence<sal_Int8> aTmpBuffer(&(pBuffer[nPos+4]), 12);
MemoryByteGrabber aMemGrabber(aTmpBuffer);
sal_Int32 nCRC32 = aMemGrabber.ReadInt32(); sal_Int32 nCRC32 = aMemGrabber.ReadInt32();
sal_uInt32 nCompressedSize32 = aMemGrabber.ReadUInt32(); sal_uInt32 nCompressedSize32 = aMemGrabber.ReadUInt32();
sal_uInt32 nSize32 = aMemGrabber.ReadUInt32(); sal_uInt32 nSize32 = aMemGrabber.ReadUInt32();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment