560 Commits
Author SHA1 Message Date
Stephan Bergmann 811769f009 Consistently use __EMSCRIPTEN__ instead of EMSCRIPTEN macro
...as emsdk 5.0.3 deprecated the predefined EMSCRIPTEN macro (see
<https://github.com/emscripten-core/emscripten/commit/506052bd8b4e23ded7f2351c62ca3b24d40c8cf3>
"Warn about usage of deprecated EMSCRIPTEN macro. NFC (#26381)"), causing
failures like

> In file included from static/source/unoembindhelpers/PrimaryBindings.cxx:29:
> In file included from include/sfx2/viewsh.hxx:35:
> In file included from include/editeng/outliner.hxx:32:
> In file included from include/tools/color.hxx:26:
> include/osl/endian.h:66:15: error: macro 'EMSCRIPTEN' has been marked as deprecated: use __EMSCRIPTEN__ instead [-Werror,-Wdeprecated-pragma]
>    66 | #elif defined EMSCRIPTEN
>       |               ^
> /home/sberg/emsdk/5.0.4/emsdk/emscripten/main/cache/sysroot/include/emscripten/emscripten.h:35:66: note: macro marked 'deprecated' here
>    35 | #pragma clang deprecated(EMSCRIPTEN, "use __EMSCRIPTEN__ instead")
>       |                                                                  ^

To avoid confusion, also suppress the -D$(OS) in
solenv/gbuild/platform/unxgcc.mk that would unnecessarily keep defining
EMSCRIPTEN.

Change-Id: Ic1f187cf1c6417cd95d4092e9cea01a665bd1b2f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/34
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 50291c2ed83bdb49bb827a4a12905d94b8c42035)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205167
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-05-14 10:11:38 +02:00
Xisco Fauli 85baadc11d related tdf#137308: remove unused InflateZstd
If needed, this patch can be revered later on

Change-Id: I83ce659bbd0070fd3f42e2961e9cf8a11db8dc40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204594
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-30 12:30:31 +02:00
Muhammad Ammar 1a6bd7b23a tdf#163691 replace memcpy with std::copy_n in package and xmlscript
Restored #include<string.h> header in both files as follow:
- /package/source/zippackage/ZipPackageBuffer.cxx
- /xmlscript/source/xml_helper/xml_byteseq.cxx

Change-Id: I5615140028c9f29eaa87e7269135748790f19ed3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204441
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-04-27 18:17:24 +02:00
Caolán McNamara ee85abda49 ofz#488752793 Integer-overflow
possibly since:

commit d7ad4553f4ec2a6117f5e6455d6325454c34464e
Date:   Fri Jul 19 20:43:05 2024 +0200

    package: ZipFile: check Zip64 end of central directory for consistency

Change-Id: I4bcaaf10be63aa5068b6c801ff1b8a2455dfc63c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200701
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2026-03-01 15:51:45 +01:00
Noel Grandin 01253d0ead no need to use SAL_WHERE when throwing exception
we already add the source location to UNO exception messages

Change-Id: I950d6ecab6fd674335db3d118e50f56aef51bed1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198649
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-02-04 13:02:56 +01:00
Stephan Bergmann 394cd5db81 Use some more ""_ustr literals
(in places that were otherwise hit by a libstdc++ 16 trunk issue involving
std::source_location that is discussed at
<https://gcc.gnu.org/pipermail/libstdc++/2026-February/065220.html> "Re: [PATCH
6/9 v4] libstdc++, contracts: Add base P2900R14 contracts support.")

Change-Id: Iaedf3e44a5f2290e194286fa035ceed8fd40da45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198627
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2026-02-04 08:22:35 +01:00
Mike Kaganski 7b04ef05cd Drop some uses Sequence::getConstArray
Similar to commit b280efcb9b
(Drop some uses Sequence::getConstArray, 2025-12-07).

Change-Id: Ieac325a660fe64e8172c5ed139380caa3d26a73c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195200
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-12-08 10:00:21 +01:00
Caolán McNamara 8788657853 drop some more COVERITY stuff
Change-Id: Ib2ac522e2ae5143fee86cb93f1e779f241129087
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192153
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-10-10 11:13:00 +02:00
Michael Stahl e1dfc36c9d tdf#168538 package: now i notice there's bRecoveryMode
Change-Id: I909ab70a97d6e89456d17a6804551abd618444a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191723
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
2025-10-01 15:46:21 +02:00
Michael Stahl 347512a77b tdf#168538 package: downgrade assert to SAL_WARN
It is only impossible during normal package parsing because of the added
consistency checks, but the inconsistency can happen during recovery.

Kind of arbitrary which size is used then?

Change-Id: I31ce9ae8b6fe3d1ca50a118ae6c1feaaaffe17ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191455
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
2025-09-24 19:47:24 +02:00
Michael Stahl abfdc11fa4 tdf#167205 package: fix writing Zip64 local headers
This would be reported on reading as an 8-byte gap at the position where
a 32-bit DD for the entry would end.

The problem is that if flag bit 3 is set, and the uncompressed size
exceeds 2^32, writeDataDescriptor() will write 8-byte sizes, but the
Zip64 extension header is missing - the latter should also write 0 even
though the APPNOTE doens't appear to require it.

      4.3.9.2 [...] When extracting, if
      the zip64 extended information extra field is present for
      the file the compressed and uncompressed sizes will be 8
      byte values.

Also make sure that the ZipEntry nSize member actually contains the
uncompressed size, which is somewhat tricky, but is required in
writeLOC() to check if Zip64 is needed.  (Assume that the DEFLATEd size
is never larger than uncompressed, which is true for every XML file).

Change-Id: I611e6ffda12d8e6953e9306dc4a4407be8e725a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191185
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
2025-09-23 11:42:58 +02:00
Noel Grandin 1ee8eb866b tdf#167936 crash when opening document from UNO pipe (2)
second attempt at this, the first commit did not catch all the places

regression from
    commit a6ad198d09
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Sat Aug 17 13:19:54 2024 +0200
    tdf#158556 use more comphelper::ByteReader

Change-Id: If3ab68f7cf147082ec296d6679d48f15ec0fdcb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189669
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
(cherry picked from commit d0530c1627cab736cf4636b4983b7d2d1f6a8882)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189676
2025-08-15 18:41:05 +02:00
Noel Grandin 7e71af5af4 tdf#167936 crash when opening document from UNO pipe
regression from
    commit a6ad198d09
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Sat Aug 17 13:19:54 2024 +0200
    tdf#158556 use more comphelper::ByteReader

Change-Id: I2cc14d0dbb0214dcf54938796eeeebefbd86bd88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189577
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-08-14 13:04:07 +02:00
Mike Kaganski 35256f5b36 Let Hash take const void* instead of const unsigned char*
It makes no sense to insist on a random type, only to reinterpret_cast
it everywhere. An opaque void fits the case perfectly.

Change-Id: If945b1c59d98c5f561350db649f29fe8036e7cdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186982
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-06-26 06:38:59 +02:00
Mike Kaganski 9727cf7859 tdf#166862: fix reading data for CRC calculation
Commit a6ad198d09 made the size read
from the grabber wrong for the last chunk: it wasn't decreased to
the remaining size, but was still equal to nBlockSize. The grabber
could read past the chunk, and the CRC was wrong. No idea why did
that only hit this file - it seemed that any file larger than 32K
and that was stored (i.e., any image) would trigger that path?

Change-Id: I980dd701e54c4ed565173b5b90ed301bf9b5f719
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186241
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-06-07 13:51:57 +02:00
Noel Grandin 0caf06c8fa remove some dead stuff in package
ever since
    commit b410749d30
    Author: Akshay Kumar Dubey <akshaymani513@gmail.com>
    Date:   Wed Apr 16 02:05:16 2025 +0530
    tdf#137308 - Add zstd build support and decompression classes

Change-Id: Ib67a2ef523ce6596b562633b0da081ba56d3ff6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185411
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-05-16 15:45:41 +02:00
Akshay Kumar Dubey b410749d30 tdf#137308 - Add zstd build support and decompression classes
Integrate build system support for the Zstandard (zstd) library and
implement the corresponding C++ decompression stream classes, enabling
future use of zstd-compressed streams in ZIP packages.

Build System (Part 2a):
- Add `--with-system-zstd=[yes|no|auto]` configure option.
- Implement system library checks (`zstd.h`, `libzstd`) in configure.ac.
- Define rules (`external/zstd/*`) for downloading and building the
  internal zstd static library (decompression components only).
- Set up necessary CFLAGS/LIBS via configure.ac and config_host.mk.in.
- Configure linking via RepositoryExternal.mk (`gb_LinkTarget__use_zstd`).
- Update auxiliary files (download.lst, distro-configs, etc.).

C++ Implementation (Part 2b):
- Implement `InflateZstd` (in `include/package`) and `InflaterBytesZstd`
  (in `package/inc`) inheriting from `Inflater`/`InflaterBytes`.
- Use the zstd streaming API (`ZSTD_decompressStream`) following the
  existing single-call pattern established by the zlib implementation.
- Manage context (`ZSTD_DCtx`) and input buffer (`ZSTD_inBuffer`) state.
- Handle errors, stream completion (`ret == 0`), and input truncation.
- Add new classes to `package/Library_package2.mk` build.

This completes the infrastructure for zstd decompression support.
The next step (Part 2c) involves adding logic to select the
appropriate Inflater based on the ZIP entry's compression method ID.

Change-Id: Ia673f3f19b6a751ba5225394fcf8c3f145c4ae63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184243
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-05-01 12:18:19 +02:00
Akshay Kumar Dubey 3e1aa5805c tdf#137308 - Part 1: Refactor Inflater classes for extensibility
Refactor ZIP decompression classes (Inflater, InflaterBytes) to support multiple decompression algorithms, enabling future Zstandard
support.

Make Inflater and InflaterBytes abstract base classes defining a common interface. Move the original zlib/Deflate logic into new derived classes InflateZlib and InflaterBytesZlib.

Update usage sites to instantiate the *Zlib variants via unique_ptr to the base class, preserving existing functionality. Move header files to standard locations (include/package, package/inc) and update includes and build files.

This pure refactoring prepares the codebase for adding Zstandard (zstd) decompression. Correct a minor logical bug in the ZipFile::getSizeAndCRC loop condition.

Change-Id: I9be3c02946e29eb2dae09f500eb47d8a4261af22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183504
Reviewed-by: Devansh Varshney <varshney.devansh614@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-04-29 09:38:52 +02:00
Michael Stahl 91b297730b tdf#166040 package: ZipFile::recover() find DD without PK78 signature
The PK78 signature is optional, and if the sizes in the local file
header are 0 then without the DD the recovery won't do anything useful.

If the latest local file header has the DD bit set in flags, then try to
find the DD before the next thing that has a PK?? signature.

Change-Id: I149a87805f7bcb6216fc909c20ece600ce77956d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183722
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2025-04-04 20:35:45 +02:00
Michael Stahl 59a18d3c3c tdf#165694 package: log specific message for missing data descriptor bit
Guess based on size of holes.

Change-Id: I6209844dd74164fa56329df8f31eb40664b2b7e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183062
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2025-03-18 14:37:56 +01:00
Noel Grandin 22f46bd89f use more concrete UNO classes
Change-Id: Id10786bbf7985adbb251224b45f9dabcc84d0a3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182721
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-03-10 14:18:35 +01:00
Noel Grandin d883aab37d loplugin:constantparam
Change-Id: Iba5ce1d44e52610e985e97d299571cf3387d938a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182180
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-02-25 19:37:56 +01:00
Noel Grandin 437aaf54c6 loplugin:unusedmethods
Change-Id: I24666a7746f8920ddf84731f204f3e1a5b9b0c85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177024
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-22 20:03:48 +01:00
Xisco Fauli 8080459c1c tdf#163486: PVS: exception thrown by pointer
Since
commit a6ad198d09
Author: Noel Grandin <noel.grandin@collabora.co.uk>
Date:   Sat Aug 17 13:19:54 2024 +0200

    tdf#158556 use more comphelper::ByteReader

V1022 	An exception was thrown by pointer. Consider throwing it by value instead.

Change-Id: I9218d79097975e47822f48838472ca2096d527d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176398
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-11-11 17:48:07 +01:00
Michael Stahl 80cda6954a tdf#163818 package: fix recovery of zip entry local header with ...
... compressed size = 0.

The problem is that vector::data() on a vector of size 0 returns
nullptr, and osl_readFile into a nullptr buffer returns E_INVAL, which
causes an exception to be thrown.

Catch the exception, so that there is a chance to read the values from
the data descriptor instead.

(regression from commit 32cad89592
 and/or commit a6ad198d09)

Change-Id: I9b2d9a930997146faf224d8033955b142fe93f58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176289
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2024-11-11 10:16:15 +01:00
Michael Stahl 0f39e6fbb4 tdf#162944 package: try to detect Zip64 via version
https://rzymek.github.io/post/excel-zip64/ claims that it's sufficient
for the version number to be 45 (4.5 - File uses ZIP64 format
extensions) for Excel to read a zip entry's data descriptor as
Zip64, while the Zip APPNOTE seems to require a zip64 extended
information extra field to be present (see 4.3.9.2).

Let's try to use the "version needed to extract" to be able to read
zip files produced by Apache POI Zip64Mode.Always.

Change-Id: I20f10471e3a85eb42d21c0cb08e36e345ef8fc9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176211
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2024-11-07 15:47:43 +01:00
Bogdan Buzea a66a69795b tdf#163486: PVS: Identical branches
V1037 Two or more case-branches perform the same actions. Check lines: 50, 53

Change-Id: I909c0b5b219d5868a1a0197314f499e0253b3293
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175388
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-22 11:59:59 +02:00
Noel Grandin 44bb2c8287 loplugin:unusedfields
Change-Id: If05b87f1e6c19b15b03b2695921a582e078d0f1a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175011
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-10-16 15:51:52 +02:00
Michael Stahl 279f42fa8b tdf#163341 package: fix reading Zip64 produced by stream-write-ods
1. Accept 0xFFFF as nEndDisk/nEndDirDisk - the Zip APPNOTE says that
   values that don't fit into 16 bits SHOULD be 0xFFFF but it doesn't
   prohibit values that do fit (like, uhm, 0) to be written as 0xFFFF

   (regression from commit ca21cc985d)

2. Fix misuse of o3tl::make_unsigned - it requires non-negative value,
   just do signed compare instead

3. Fix bad conversion from pointer to optional in
   ZipFile::readExtraFields() which effectively prevented the offset
   from being read

   (regression from commit efae4fc42d)

Change-Id: Ib5e7776a30834e507b297fb28266b5489d1ab68d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174898
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-10-14 15:56:42 +02:00
Michael Stahl ab10484cf1 package: remove superfluous assert
Change-Id: I20bc36c4e3c3c2cb05d4f89f0687b9d87f02999d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173558
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-18 12:15:36 +02:00
Michael Stahl 9012355a60 tdf#162866 package: fix loading AutoCorrect file with case-insensitive
... duplicates; the directory names of AutoCorrect entries are
user-editable, so this needs to be supported.

AutoCorrect uses an ODF package because the ODF document loading code
requires the ODF document to be in an ODF storage with a MediaType
property.

AutoCorrect writes an empty mimetype file, and if such is present in an
.odt file that is being loaded, existing checks will detect it as
corrupted, so we can use this to check that the file is an AutoCorrect
file and turn off the case-insensitive check.

(regression from commit 4833f13124)

Change-Id: I43887f7dad0c8cbb465b4c0f1c38bcc3244a7675
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173477
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2024-09-17 10:40:29 +02:00
Mike Kaganski 61deab29ca Avoid nedless buffer initialization
Not possible yet to use std::make_unique_for_overwrite, baseline
compiler versions are not ready.

Change-Id: Ie14ac5210fa63dcdc7755bb8c722800a877acd44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173381
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-09-15 11:28:16 +02:00
Caolán McNamara 698ae0fc16 Related: ofz#71490 replace reserve with resize
when we are going to write to data()

Change-Id: I1412849911d7bbb990a5f0d712f3ac51a5fea163
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173373
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-09-15 10:20:33 +02:00
Caolán McNamara e6be4ec010 ofz#71490 Container-overflow in SvMemoryStream::GetData
since:

commit a6ad198d09
CommitDate: Tue Aug 27 09:10:04 2024 +0200

    tdf#158556 use more comphelper::ByteReader

reserve doesn't make any guarantees about validity of subsequent data()

Change-Id: Ifb155b349b15103c367d841bbef7d5d0e2cbb5f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173371
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-09-14 22:10:02 +02:00
Caolán McNamara d22d47e940 ofz: 22 byte .zip is min size
at which point nPos is 0 on entering this test.

If the buffer does not start with PK\x5\x6 then nPos is decremented
before checking against 0, so nPos is -1 and doesn't throw as an
unhandled .zip.

Change-Id: I4a7fed6e863582324945a75bc077f6346ddd5c23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173208
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-13 12:46:56 +02:00
Michael Stahl 33d55465d9 tdf#162823 package: fix loss of ODF encrypted basic macros
The problem is that there is a ZipEntry ZipPackageStream::aEntry which
does not necessarily correspond to the values read from the Zip central
directory, because of a call to ZipPackageStream::setSize() in
ZipPackageStream::successfullyWritten() to override nSize and nMethod
for encrypted entries.

This triggers the consistency checks in readLOC(), where this aEntry is
passed.

Refactor things so that ZipPackageStream::aEntry and thus hopefully all
ZipEntry instances correspond to the Zip file's central directory.

For encrypted entries, store the decompressed size (which is read from
manifest.xml) in m_nOwnStreamOrigSize and pass it as a separate
parameter to the ZipFile functions that need it, and ultimately to
XUnbufferedStream, resolving multiple TODO comments.

(regression from commit efae4fc42d)

Change-Id: Ib6ea32595c6027b98da9196a2e2bd0a99b62a983
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173273
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2024-09-13 11:32:38 +02:00
Mike Kaganski 84f6d11780 Use unique_ptr to pass ownership of ZipEntry
Change-Id: I09ffa752d2cd0367579e9384b992215b2d79b251
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172963
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-09-07 17:11:48 +02:00
Caolán McNamara 6e5ff9c596 cid#1618664 Self assignment
used to be:
    Sequence<sal_Int8> aFileName;
    aGrabber.readBytes(aFileName, aEntry.nPathLen);
    aEntry.nPathLen = aFileName.getLength();
so aEntry.nPathLen ended up as the the count of read bytes actually
read when aEntry.nPathLen was requested

Change-Id: I50b2c4c7be086e4b846998ee52fbabed6159279d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172508
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-08-28 12:16:46 +02:00
Caolán McNamara 9520ff2c4d cid#1618667 Uninitialized pointer field
Change-Id: Iaf23214c6931d068b37dbb04cfc73ae7f9a3d7ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172506
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-08-28 12:16:38 +02:00
Noel Grandin bf1099e360 tdf#158556 reduce allocations in ZipFile
we can allocate these buffers one caller up in ReadCEN and then re-use
them

Change-Id: I07e98168ee2884286f4a1c281acd86e365416149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172481
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-08-28 07:35:23 +02:00
Noel Grandin 1a47d1e00d tdf#158556 unnecessary temporary OUString in ZipFile
Change-Id: Iea3bf5fa9ba5210eabca521316cfd68b440ec806
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172458
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-08-27 17:24:36 +02:00
Noel Grandin a6ad198d09 tdf#158556 use more comphelper::ByteReader
which avoids a ton of temporary uno::Sequence being created

Change-Id: I237bb69395f692bb0272ca0daec05b81af828e01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171968
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-08-27 09:10:04 +02:00
Caolán McNamara c3d7113cdf cid#1607270 silence Overflowed integer argument
Change-Id: I6238fe6fdf28e876c636ce12022c0458e9548578
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172027
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-19 15:15:46 +02:00
Noel Grandin 4f5d694e58 tdf#158556 ByteGrabber does not need a mutex
it is only used from one place, and that place already locks a mutex
around all usage

Change-Id: I85a8d89220bee7806db5457d69cfcf2f11c1734d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171947
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-08-16 14:01:07 +02:00
Michael Stahl 32cad89592 package: ZipPackage: add additional check for entries STORED with
... data descriptor; only allow it for encrypted ODF entries, which
requires reading the manifest first.

Change-Id: If36d31a4cb93e7af78f48be3ed899ad9d9bb28f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171911
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-08-16 10:29:58 +02:00
Caolán McNamara 4551356827 cid#1615990 silence Overflowed integer argument
Change-Id: I37ff85c8d6363bd1e9fb1097dc107bca2ad73738
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171926
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-16 09:30:27 +02:00
Michael Stahl cf23025faa package: clarify comment
Change-Id: Id1a262dee4bd182c0aa3f938efb3808e3182602d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171834
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-08-14 10:46:40 +02:00
Michael Stahl ca21cc985d package: ZipFile: check Zip64 end of central directory for consistency
Change-Id: Iae873ec8175922e210398ef8e0f83e148a795c2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170783
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2024-07-29 12:40:23 +02:00
Caolán McNamara fdd5d471c1 cid#1607270 silence Overflowed integer argument
Change-Id: Ie5973c23d2d106815af0d1300a99687a84cfed1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170822
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-22 09:34:18 +02:00
Caolán McNamara d33d592801 cid#1554791 COPY_INSTEAD_OF_MOVE
and

cid#1554819 COPY_INSTEAD_OF_MOVE
cid#1554837 COPY_INSTEAD_OF_MOVE
cid#1554881 COPY_INSTEAD_OF_MOVE
cid#1554882 COPY_INSTEAD_OF_MOVE
cid#1554884 COPY_INSTEAD_OF_MOVE
cid#1554891 COPY_INSTEAD_OF_MOVE
cid#1554892 COPY_INSTEAD_OF_MOVE
cid#1554897 COPY_INSTEAD_OF_MOVE
cid#1554904 COPY_INSTEAD_OF_MOVE
cid#1554918 COPY_INSTEAD_OF_MOVE
cid#1554928 COPY_INSTEAD_OF_MOVE
cid#1554931 COPY_INSTEAD_OF_MOVE
cid#1554944 COPY_INSTEAD_OF_MOVE
cid#1554945 COPY_INSTEAD_OF_MOVE
cid#1554959 COPY_INSTEAD_OF_MOVE
cid#1554960 COPY_INSTEAD_OF_MOVE
cid#1554963 COPY_INSTEAD_OF_MOVE
cid#1554966 COPY_INSTEAD_OF_MOVE
cid#1554969 COPY_INSTEAD_OF_MOVE
cid#1554973 COPY_INSTEAD_OF_MOVE
cid#1555011 COPY_INSTEAD_OF_MOVE
cid#1555012 COPY_INSTEAD_OF_MOVE
cid#1555015 COPY_INSTEAD_OF_MOVE
cid#1555044 COPY_INSTEAD_OF_MOVE
cid#1555051 COPY_INSTEAD_OF_MOVE
cid#1555055 COPY_INSTEAD_OF_MOVE
cid#1555063 COPY_INSTEAD_OF_MOVE
cid#1555068 COPY_INSTEAD_OF_MOVE
cid#1555073 COPY_INSTEAD_OF_MOVE
cid#1555074 COPY_INSTEAD_OF_MOVE
cid#1555078 COPY_INSTEAD_OF_MOVE
cid#1555080 COPY_INSTEAD_OF_MOVE
cid#1555091 COPY_INSTEAD_OF_MOVE
cid#1555099 COPY_INSTEAD_OF_MOVE
cid#1555101 COPY_INSTEAD_OF_MOVE
cid#1555121 COPY_INSTEAD_OF_MOVE
cid#1610739 COPY_INSTEAD_OF_MOVE
cid#1608424 COPY_INSTEAD_OF_MOVE
cid#1608059 COPY_INSTEAD_OF_MOVE
cid#1607952 COPY_INSTEAD_OF_MOVE
cid#1607653 COPY_INSTEAD_OF_MOVE
cid#1607614 COPY_INSTEAD_OF_MOVE
cid#1607592 COPY_INSTEAD_OF_MOVE

Change-Id: Ie9f922a9fe1b8001dfab31e2741fe8bd5558e442
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170802
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-20 23:03:28 +02:00