diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-02-08 00:10:21 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-02-08 00:10:21 +0100 |
commit | 18e39b8c4da749e0cad428e7f35931d02e9ecc9f (patch) | |
tree | ccdf98efbc4dae2ec5050cf74c80c7b5e2ecf381 /package | |
parent | 95132670c54791614d34e0ec5751b5c09d4c02f9 (diff) | |
parent | fa01a166515fe2bcf7309e0bc3f71accb8a981ba (diff) |
Merge remote branch 'origin/libreoffice-3-3'
Conflicts:
cui/source/tabpages/swpossizetabpage.cxx
Diffstat (limited to 'package')
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index a2751b8b5fc0..080005b66128 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -844,13 +844,18 @@ sal_Int32 ZipFile::recover() aGrabber.seek( 0 ); - for( sal_Int32 nGenPos = 0; aGrabber.readBytes( aBuffer, 32000 ) && aBuffer.getLength() > 30; ) + const sal_Int32 nToRead = 32000; + for( sal_Int32 nGenPos = 0; aGrabber.readBytes( aBuffer, nToRead ) && aBuffer.getLength() > 16; ) { const sal_Int8 *pBuffer = aBuffer.getConstArray(); sal_Int32 nBufSize = aBuffer.getLength(); sal_Int32 nPos = 0; - while( nPos < nBufSize - 16 ) + // the buffer should contain at least one header, + // or if it is end of the file, at least the postheader with sizes and hash + while( nPos < nBufSize - 30 + || ( nBufSize < nToRead && nPos < nBufSize - 16 ) ) + { if ( nPos < nBufSize - 30 && pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 3 && pBuffer[nPos+3] == 4 ) { |