summaryrefslogtreecommitdiff
path: root/package/source/zipapi
AgeCommit message (Collapse)Author
2018-11-07loplugin:collapseif in framework..salNoel Grandin
Change-Id: I3068b18f5cff024a48a8f8c68d69cadad30fe4d5 Reviewed-on: https://gerrit.libreoffice.org/62953 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-03tdf#120703 PVS: V547 Expression is always true/falseMike Kaganski
Change-Id: I856345576ff5c10a41509a97ad4539272bd55568 Reviewed-on: https://gerrit.libreoffice.org/62803 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-31Translate German commentsJohnny_M
Change-Id: I94cdb753d01dfd0d5b8f78ede1819b281b840ab2 Reviewed-on: https://gerrit.libreoffice.org/62669 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2018-10-15clang-tidy misc-redundant-expressionNoel Grandin
Change-Id: I708b0b486a233071f95592ccdb97f27fc35a23c4 Reviewed-on: https://gerrit.libreoffice.org/61783 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-13loplugin:constfields in package..registryNoel Grandin
Change-Id: Ie139490f2b008bf294910d002af711f8f41fe76d Reviewed-on: https://gerrit.libreoffice.org/61727 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-09loplugin:simplifyconstruct in l10ntools..packageNoel Grandin
Change-Id: I8dba8ef1e7455af1e55bbd6086b49c0606bf4927 Reviewed-on: https://gerrit.libreoffice.org/60212 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-29loplugin:constantparam (2)Noel Grandin
Change-Id: I528f22876497f87159e3b9453362ebbfb55b7092
2018-08-23Related rhbz#1618703: Properly handle failure encoding zip fileStephan Bergmann
...when e.g. FIPS mode makes ZipFile::StaticGetCipher fail by throwing an exception which would be caught by ZipPackageStream::saveChild (in package/source/zippackage/ZipPackageStream.cxx) alright (and translated into bSuccess = false), if ZipFile::StaticGetCipher didn't unhelpfully swallow and ignore all exceptions in an outer try-catch. Change-Id: I14376128515df1dd4bdac921edd8ab94cc9b7617 Reviewed-on: https://gerrit.libreoffice.org/59514 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-15loplugin:useuniqueptr in consumeScheduledThreadEntryNoel Grandin
Change-Id: I9c0b05081915712089d363a476d6354cfba2461d Reviewed-on: https://gerrit.libreoffice.org/59010 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-13loplugin:returnconstant in oox,packageNoel Grandin
Change-Id: I1dade7ddde6b1e226861d32f24f65be5bb9d9352 Reviewed-on: https://gerrit.libreoffice.org/58880 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-04use C++11 exception rethrowingCaolán McNamara
for those cases where we are doing relatively simple catching and rethrowing e.g. catch in one thread and throw in main thread. Change-Id: I6192017c4ec99dd671a9582f7b004096b0fc4525 Reviewed-on: https://gerrit.libreoffice.org/58588 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-07-31ofz#9597 rethrown IOException not caught by catch IOExceptionCaolán McNamara
under google oss-fuzz, asan + clang version 6.0.0 (trunk 315613) when using our own exception thrower, but builtin C++11 support works also, ofz#9266, ofz#9591, ofz#9597, ofz#9622, etc Change-Id: I29c692da880b49268284de2f61be07fa94f33bc6 Reviewed-on: https://gerrit.libreoffice.org/58223 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-30Add missing sal/log.hxx headersGabor Kelemen
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from l10ntools to reportdesign Change-Id: Ia2dc93dd848c2dc0b6a8cb6e19849c614ec55198 Reviewed-on: https://gerrit.libreoffice.org/58205 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-27skip checking zip crcs when fuzzingCaolán McNamara
Change-Id: If90828e508178dfaaee51f88cf52ada0aec5970c Reviewed-on: https://gerrit.libreoffice.org/58120 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-08tdf#84323 - sal - add sane sleep interface: cleanup osl_waitThreadKevin Dubrulle
Replace osl_waitThread by osl::Thread::wait. Use std::chrono instead of TimeValue. Change-Id: I71691d014feeeb0c5d0ba29d048bda8e25e6e7dd Reviewed-on: https://gerrit.libreoffice.org/57130 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-04Make ThreadPool::pushTask take param by std::unique_ptrNoel Grandin
And fix leak in XclExpRowBuffer::Finalize, was not freeing the synchronous task it creates Change-Id: Id1e9ddb5d968e6b95d9d2b5ca0c9e50774580182 Reviewed-on: https://gerrit.libreoffice.org/56874 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-05tdf#42949 remove unused compheler includes ..Jochen Nitschke
and fix the fallout Change-Id: I15bc5d626f4d157cbc69a87392078b41e621d14e Reviewed-on: https://gerrit.libreoffice.org/54882 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-04-23loplugin:useuniqueptr in Inflater,DeflaterNoel Grandin
Change-Id: I55833664a6e76d781908b8f1f721dd9a4946e35f Reviewed-on: https://gerrit.libreoffice.org/53224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-23forcepoint #5 check for short readCaolán McNamara
a zip file within a structured storage stream. underlying storage stream claims larger size that it can satisfy on read Change-Id: I8516b12df33ad78b2525192826f5e3aef2622eb8 Reviewed-on: https://gerrit.libreoffice.org/50238 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-07Prevent MemoryByteGrabber from ever taking temporaries againStephan Bergmann
...after c99527385acf367c748b3dcf3e6a3bb8103f5eee "MemoryByteGrabber sequence has to exist for Grabber lifetime" Change-Id: Idcb7548aaa7741e8e535024ba36c7a171a6c2fb4
2018-02-07MemoryByteGrabber sequence has to exist for Grabber lifetimeCaolán McNamara
it just takes a c++ ref, so a temp is an unsuitable arg Change-Id: I40490e94d977df91b985bc4ae458b68ee85d5dfe Reviewed-on: https://gerrit.libreoffice.org/49321 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-01-19crashtesting: failure on import with bogus valuesCaolán McNamara
regression from... commit 7d8e94444d989d0ac4a4055b207726708e9ec0da Date: Thu Jan 11 08:47:15 2018 +0200 convert a<b?a:b to std::min(a,b) cause old promotion was to the largest type, so with a large 64bit nDiff and any 32bit nRequestedBytes the nRequestedBytes was promoted to 64bit, found to be smaller than nDiff, then would fit in 32bit. newer code cast both to 32bit, resulting in a negative nDiff which was smaller than nRequestedBytes, but going on to cause havoc. Change-Id: I9eb5c61302b3dccf5333c4dfbf9ac92ce49585b5 Reviewed-on: https://gerrit.libreoffice.org/48155 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-01-15convert a<b?a:b to std::min(a,b)Noel Grandin
with something like git grep -nP '(.*)\s*<\s*(.*)\s*\?\s*\g1\s*:\s*\g2' -- *.?xx Change-Id: Id5078b35961847feb78a66204fdb7598ee63fd23 Note: we also convert a>b?b:a Reviewed-on: https://gerrit.libreoffice.org/47736 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-13tdf#114550 don't use PBKDF2 in package for gpg encryptionThorsten Behrens
No need to derive password-based key, simply skip rtl_digest_PBKDF2 for the gpg4libre case. Also pass down PBKDF2 iteration count from ZipPackage, which knows about GPG encryption, instead of just always setting it in package stream. We otherwise needlessly iterate session key also for gpg encrypted storages. Change-Id: Ic96b2193f8541bbd109795fb9c0212a0a10c7344 Reviewed-on: https://gerrit.libreoffice.org/47783 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-13tdf#114550 recognize sym key & init vec as valid f/ decryptThorsten Behrens
Otherwise package code would _only_ try to decrypt for salt and iteration count present, which does not make sense for gpg. Change-Id: Ie366f086a3c14d6b54b91b4edee8cfef1a42c44b Reviewed-on: https://gerrit.libreoffice.org/47782 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-12tdf#114939 package,comphelper: Try both real SHA1 and StarOffice SHA1Michael Stahl
... when importing ODF documents. In CreatePackageEncryptionData(), add a 3rd SHA1 password hash, PackageSHA1CorrectEncryptionKey, to EncryptionData. Use it in ZipPackageStream::getDataStream(), which has 3 fall-backs for SHA1 bugs now. Also add a CorrectSHA1DigestContext, to be used together with PackageSHA1CorrectEncryptionKey, and rename the existing one to StarOfficeSHA1DigestContext, to be used together with the existing 2 PackageSHA1{UTF8,MS1252}EncryptionKey. The fallback won't be used very often anyway: for the password SHA1 to be wrong, you need a password between 52 and 55 bytes long, and for the SHA1/1K checksum to be wrong, you need a file smaller than 1K with compressed size mod 64 between 52 and 55; all XML files have enough random "chaff" added to be too large. Test that we can read both correct SHA1 and StarOffice SHA1. Change-Id: I988fa489b5e40c7657f404f18538f637d54d28f1
2018-01-06tdf#114819 - include the synthetic encrpytion header into the size.Michael Meeks
Change-Id: I090347046725a1ebb7a36f465654c29f7443d20d Reviewed-on: https://gerrit.libreoffice.org/47467 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-12-27ofz#4806 Infinite loopCaolán McNamara
Change-Id: I89a24fa3ce4034ef207233b96c5e26a7b7787444 Reviewed-on: https://gerrit.libreoffice.org/47096 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-12-10remove unused osl/time.h includes ..Jochen Nitschke
and some more in base64.cxx Change-Id: I31c9f23d3bd11f5482774e976a7c40025ffcfb86 Reviewed-on: https://gerrit.libreoffice.org/46157 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-05loplugin:salcall fix non-virtual methodsNoel Grandin
first, since those are safer to change than virtual methods Change-Id: Ie3b624019d75ee2b793cee33b3c5f64e994e8bfe Reviewed-on: https://gerrit.libreoffice.org/45798 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-27keep track of available dataCaolán McNamara
Change-Id: Idc54cdef0f3a4355a7e26f25cdc5b50d65d9d583 Reviewed-on: https://gerrit.libreoffice.org/45351 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-24fix attempt to save and rethrow exceptionCaolán McNamara
Change-Id: Idff6ffef536d87d85f1092b3316d65da83527711 Reviewed-on: https://gerrit.libreoffice.org/45229 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-04loplugin:constparams in various(1)Noel Grandin
Change-Id: Ic80ca59abc3e104c7adf0c1eff1d16addf48bc8b Reviewed-on: https://gerrit.libreoffice.org/44261 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-01-Werror,-Wunused-private-fieldStephan Bergmann
Change-Id: I4ba10f68cf87315a9a3f6970338b8d9f6ac7a62c
2017-11-01loplugin:finalclasses in packageNoel Grandin
Change-Id: I020ea1f3bea5c3deab05b9a2154102548c7622cf Reviewed-on: https://gerrit.libreoffice.org/44132 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-23loplugin:includeform: packageStephan Bergmann
Change-Id: I64200b2d03d579c5c83d1ec0cc8aaa839edaa7ed
2017-10-04add << operator for css::uno::ExceptionNoel Grandin
Change-Id: Ia23dafd07133779144965682df3b7125a3214235 Reviewed-on: https://gerrit.libreoffice.org/43046 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-09-29loplugin:flatten check for throw in then clauseNoel Grandin
also make the plugin ignore the case where we have var decl's in the clause we want to flatten, which could lead to problematic extension of variable lifetime Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59 Reviewed-on: https://gerrit.libreoffice.org/42889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-22loplugin:flatten in framework..packageNoel Grandin
Change-Id: Ide8a97eae6e2fdc7d2dcccba1480ac55a9b555bc Reviewed-on: https://gerrit.libreoffice.org/42593 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-20Fixing threadedStream produce loop condition:Mohammed Abdul Azeem
hasBytes() is for the consuming thread, produce loop should be stopped as soon as we've read as much as size of the stream. Change-Id: I0d857cc9cbcc4dd7d4a43cddbc4c457e8280353f Reviewed-on: https://gerrit.libreoffice.org/41364 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2017-07-31loplugin:constparams in basctlNoel Grandin
Change-Id: If6c2b980a2916c4ee8ac108fbb84b006a35f49c5 Reviewed-on: https://gerrit.libreoffice.org/40570 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-28loplugin:checkunusedparams more part1Noel Grandin
seems I got one of the checks wrong, and was missing a bunch of stuff Change-Id: I2c662fc4e735f8d6cbe56c6f82906a60a580331b Reviewed-on: https://gerrit.libreoffice.org/40481 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-19tdf#108835 Fixed writer crash on adding Autocorrect Entry:Mohammed Abdul Azeem
ZipPackageStream::saveChild seeks and reads on the same stream, so it cannot be done parallely. Also, read on BufferedStream tries to aquire the same mutes, which is already aquired by the calling method resulting in deadlock. Using UnbufferedStream here should solve both. Change-Id: I25b7ca2ff3c31125cf107fe404f9af66435bec7d Reviewed-on: https://gerrit.libreoffice.org/40160 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-18loplugin:constparams in packageNoel Grandin
Change-Id: I78386422f90f860647c844666548cd63e630b9a7 Reviewed-on: https://gerrit.libreoffice.org/40125 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-13use more OUString::operator== in forms..salNoel Grandin
Change-Id: I70d7e50f8c1e019524ccad915f0cca912c5035dc Reviewed-on: https://gerrit.libreoffice.org/39899 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-07tdf#108821 - fix for overflow of variables on opening huge filesMohammed Abdul Azeem
This should fix the issue, as well as restrict available to return only non-negative values. Change-Id: I198e226e945b9bd79dec32b1686c20e2a8dfaf3e Reviewed-on: https://gerrit.libreoffice.org/39665 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-07-06tdf#108821 - fixed bad alloc on opening large fileMichael Meeks
Workaround for streams with size > SAL_MAX_INT32. More complicated ways using available() and navigating cross-thread are possible, but probably harder to maintain. Change-Id: I721b1f38055dfcea03fef555b8a5fd93dfc1b886 Reviewed-on: https://gerrit.libreoffice.org/39374 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-06-20create comphelper::RefCountedMutexNoel Grandin
and merge the two existing implementations of the idea - SotMutexHolder from package and RefCountedMutex from connectivity Change-Id: I87f09f359ac798cf934381a2c75225dab71dd43e Reviewed-on: https://gerrit.libreoffice.org/38972 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-13Avoid race between mbTerminate check and wait.Michael Meeks
package2.dll!osl::Thread::join() Line 112 C++ package2.dll!XBufferedThreadedStream::~XBufferedThreadedStream() Line 68 C++ package2.dll!XBufferedThreadedStream::`scalar deleting destructor'(unsigned int) C++ vs. package2.dll!std::condition_variable::wait<bool <lambda>(void) >... package2.dll!XBufferedThreadedStream::produce() Line 95 C++ package2.dll!`anonymous namespace'::UnzippingThread::execute() Line 29 C++ Change-Id: Iace86efc5e7fe00a5176380a8a21b2dc5e98d8a5 Reviewed-on: https://gerrit.libreoffice.org/38737 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-06-12Setting Buffered(threaded)Stream as default:Mohammed Abdul Azeem
Also cleaning up bUseBufferedStream parameter. Change-Id: Ibf9c9fcefbdcd229ffaa1d3b169ff87f00e91ceb Reviewed-on: https://gerrit.libreoffice.org/38661 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>