Commit Graph

10420 Commits

Author SHA1 Message Date
Xavier Mitault
3c3845b9d8
Add target_include_directories because windows and macos need it for me 2023-10-23 17:38:09 +02:00
dependabot[bot]
af971cec65
Bump actions/checkout from 4.1.0 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8ade135a41...b4ffde65f4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-23 05:56:05 +00:00
Yann Collet
7567769a7e
Merge pull request #3789 from facebook/fix_flexArray_fse
solving flexArray issue #3785 in fse
2023-10-20 12:40:13 -07:00
Yann Collet
24dabde507 revert to manually defining DTable
thus avoiding the analyzer and ubsan to associate DTable to a size of 1.
2023-10-18 22:45:57 -07:00
Yann Collet
d988e00a7f baby-step towards solving flexArray issue #3785
the flexArray in structure FSE_DecompressWksp
is just a way to derive a pointer easily,
without risk/complexity of calculating it manually.

Not sure if this change is good enough to avoid ubsan warnings though.
2023-10-18 16:21:39 -07:00
Xavier Mitault
e590c8a0e3
Add doc on how to use it with cmake FetchContent 2023-10-18 13:22:15 +02:00
Yann Collet
69036dffe5
Merge pull request #3786 from facebook/fix_flexarray_cctx
Remove FlexArray pattern from ZSTDMT
2023-10-13 09:08:20 -07:00
Yann Collet
6bb1688c1a extended the fix to ZSTDMT's Buffer Pool 2023-10-08 00:25:17 -07:00
Yann Collet
ea4027c003 removed unused macro constant 2023-10-07 23:32:22 -07:00
Yann Collet
c87ad5bdb5 fixes suggested by @ebiggers 2023-10-07 23:29:42 -07:00
Yann Collet
e8ff7d18eb removed FlexArray pattern from CCtxPool
within ZSTDMT_.
This pattern is flagged by less forgiving variants of ubsan
notably used during compilation of the Linux Kernel.

There are 2 other places in the code where this pattern is used.
This fixes just one of them.
2023-10-07 21:30:08 -07:00
Yann Collet
c692b8d12d
Merge pull request #3752 from paulmenzel/fix-pzstd-makefile
Fix pzstd Makefile to allow setting `DESTDIR` and `BINDIR` separately
2023-10-07 19:32:22 -07:00
Yann Collet
2b31cb0698
Merge pull request #3763 from dloidolt/fix_lib/README.md
Fix a very small formatting typo in the lib/README.md file
2023-10-07 19:31:36 -07:00
Yann Collet
19317239ec
Merge pull request #3772 from DimitriPapadopoulos/WIN32
Do not test WIN32, instead test _WIN32
2023-10-07 19:30:18 -07:00
Yann Collet
c1e588fcb4
Merge pull request #3771 from DimitriPapadopoulos/codespell
Fix new typos found by codespell
2023-10-07 19:29:41 -07:00
Yann Collet
4f77b81c8a Merge pull request #3777 from facebook/fix_x32
fix x32 tests on Github CI
2023-10-06 08:05:29 -04:00
Yann Collet
0e2cfebb63
Merge pull request #3777 from facebook/fix_x32
fix x32 tests on Github CI
2023-10-02 16:25:43 -07:00
Nick Terrell
43118da8a7 Stop suppressing pointer-overflow UBSAN errors
* Remove all pointer-overflow suppressions from our UBSAN builds/tests.
* Add `ZSTD_ALLOW_POINTER_OVERFLOW_ATTR` macro to suppress
  pointer-overflow at a per-function level. This is a superior approach
  because it also applies to users who build zstd with UBSAN.
* Add `ZSTD_wrappedPtr{Diff,Add,Sub}()` that use these suppressions.
  The end goal is to only tag these functions with
  `ZSTD_ALLOW_POINTER_OVERFLOW`. But we can start by annoting functions
  that rely on pointer overflow, and gradually transition to using
  these.
* Add `ZSTD_maybeNullPtrAdd()` to simplify pointer addition when the
  pointer may be `NULL`.
* Fix all the fuzzer issues that came up. I'm sure there will be a lot
  more, but these are the ones that came up within a few minutes of
  running the fuzzers, and while running GitHub CI.
2023-09-28 17:35:05 -04:00
Nick Terrell
3daed7017a Revert "Work around nullptr-with-nonzero-offset warning"
This reverts commit c27fa39904.
2023-09-28 17:35:05 -04:00
Yann Collet
2c17e05646 fix x32 tests on Github CI
ubuntu-22.04 seems to have problems with x32 recently
switching to ubuntu-20.04 which seems to work fine so far

https://github.com/actions/runner-images/issues/8397
2023-09-27 21:18:20 -07:00
Yann Collet
7b762364cb
Merge pull request #3774 from facebook/dependabot/github_actions/actions/checkout-4.1.0
Bump actions/checkout from 4.0.0 to 4.1.0
2023-09-24 23:34:06 -07:00
dependabot[bot]
d5cbae7c50
Bump actions/checkout from 4.0.0 to 4.1.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](3df4ab11eb...8ade135a41)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-25 05:18:07 +00:00
Dimitri Papadopoulos
585aaa0ed3
Do not test WIN32, instead test _WIN32
To the best of my knowledge:
* `_WIN32` and `_WIN64` are defined by the compiler,
* `WIN32` and `WIN64` are defined by the user, to indicate whatever
  the user chooses them to indicate. They mean 32-bit and 64-bit Windows
  compilation by convention only.

See:
https://accu.org/journals/overload/24/132/wilson_2223/

Windows compilers in general, and MSVC in particular, have been defining
`_WIN32` and `_WIN64` for a long time, provably at least since Visual Studio
2015, and in practice as early as in the days of 16-bit Windows.

See:
https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-140
https://learn.microsoft.com/en-us/windows/win32/winprog64/the-tools

Tests used to be inconsistent, sometimes testing `_WIN32`, sometimes
`_WIN32` and `WIN32`. This brings consistency to Windows detection.
2023-09-23 19:03:18 +02:00
Dimitri Papadopoulos
fe34776c20
Fix new typos found by codespell 2023-09-23 18:56:01 +02:00
Nick Terrell
cdceb0fce5 Improve macro guards for ZSTD_assertValidSequence
Refine the macro guards to define the functions exactly when they are
needed.

This fixes the chromium build with zstd.

Thanks to @GregTho for reporting!
2023-09-22 16:36:14 -04:00
Dominik Loidolt
48b5a7bd8b Fix a very small formatting typo in the lib/README.md file 2023-09-19 16:22:47 +02:00
Yann Collet
1c007e64b8
Merge pull request #3755 from facebook/estimate_doc
added some documentation on ZSTD_estimate*Size() variants
2023-09-18 22:32:40 -07:00
Yann Collet
3fc14e411b added some documentation on ZSTD_estimate*Size() variants
as a follow up for #3747
2023-09-13 11:35:19 -07:00
Yann Collet
823b32ce43
Merge pull request #3749 from facebook/dependabot/github_actions/actions/checkout-4.0.0
Bump actions/checkout from 3.5.3 to 4.0.0
2023-09-12 13:58:08 -07:00
Yann Collet
1ec201c7b9
Merge pull request #3745 from klausholstjacobsen/qnx-support
Added qnx in the posix test section of platform.h
2023-09-12 13:43:59 -07:00
Yann Collet
f2bc34d9b4
Merge pull request #3750 from facebook/dependabot/github_actions/actions/upload-artifact-3.1.3
Bump actions/upload-artifact from 3.1.2 to 3.1.3
2023-09-12 13:43:00 -07:00
Paul Menzel
d55ebb5718 [pzstd]: Fix DESTDIR handling to allow setting BINDIR
Currently, setting `BINDIR` and `DESTDIR` separately is not possible, so
the command below fails, as BINDIR is set explicitly:

    $ make -j80 install PREFIX=/usr EPREFIX=/usr BINDIR=/usr/bin SBINDIR=/usr/sbin LIBEXECDIR=/usr/libexec SYSCONFDIR=/etc SHAREDSTATEDIR=/var LOCALST ATEDIR=/var LIBDIR=/usr/lib INCLUDEDIR=/usr/include DATAROOTDIR=/usr/share DATADIR=/usr/share INFODIR=/usr/share/info LOCALEDIR=/usr/share/locale MAND IR=/usr/share/man DOCDIR=/usr/share/doc/zstd DESTDIR=/dev/shm/bee-pmenzel/zstd/zstd-1.5.5-0/image -C contrib/pzstd DESTDIR=/dev/shm/bee-pmenzel/zstd/zstd-1.5.5-0/image
    make: Entering directory
    '/dev/shm/bee-pmenzel/zstd/zstd-1.5.5-0/source/contrib/pzstd' CFLAGS="  -I../../lib -I../../lib/common -I../../programs -I. -DNDEBUG -O3 -Wall -Wextra -Wno-deprecated-declarations   " LDFLAGS=" -O3 -Wall -Wextra -pedantic  " make -C ../../lib libzstd.a
    make[1]: Entering directory '/dev/shm/bee-pmenzel/zstd/zstd-1.5.5-0/source/lib'
    make[1]: Leaving directory '/dev/shm/bee-pmenzel/zstd/zstd-1.5.5-0/source/lib'
    g++ main.o ../../programs/util.o Options.o Pzstd.o SkippableFrame.o ../../lib/libzstd.a           -O3 -Wall -Wextra -pedantic    -pthread -o pzstd
    install -d -m 755 /usr/bin/
    install -m 755 pzstd /usr/bin/pzstd
    install: cannot create regular file '/usr/bin/pzstd': Permission denied
    make: *** [Makefile:116: install] Error 1

So, do not prefix `BINDIR` with `DESTDIR`, and adapt all paths for
installation. This is more common, and, for example, `programs/Makefile`
does the same.

Fixes: 8b4e84249b ("[pzstd] Fix Makefile")
2023-09-12 19:15:25 +02:00
dependabot[bot]
d8b25cbf68
Bump actions/upload-artifact from 3.1.2 to 3.1.3
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b7f8abb15...a8a3f3ad30)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 05:09:05 +00:00
dependabot[bot]
e0e309f27c
Bump actions/checkout from 3.5.3 to 4.0.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 4.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](c85c95e3d7...3df4ab11eb)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 05:09:02 +00:00
Yann Collet
01dbbdf560
Merge pull request #3739 from JohanMabille/cmake
Fixed zstd cmake shared build on windows
2023-09-10 06:32:24 -07:00
Yann Collet
1de57bb271
Merge pull request #3733 from ldv-alt/zdictlib_fix_prototype_mismatch
zdictlib: fix prototype mismatch
2023-09-10 06:31:52 -07:00
klausholstjacobsen
839c7939e8 Added qnx in the posix test section of platform.h 2023-09-03 11:40:53 +02:00
Johan Mabille
253873220f Fixed zstd cmake shared build on windows 2023-08-27 16:51:24 +02:00
Nick Terrell
396ef5b434 Fix & refactor Huffman repeat tables for dictionaries
The Huffman repeat mode checker assumed that the CTable was zeroed in the region `[maxSymbolValue + 1, 256)`.
This assumption didn't hold for tables built in the dictionaries, because it didn't go through the same codepath.

Since this code was originally written, we added a header to the CTable that specifies the `tableLog`.
Add `maxSymbolValue` to that header, and check that the table's `maxSymbolValue` is at least the block's `maxSymbolValue`.

This solution is cleaner because we write this header for every CTable we build, so it can't be missed in any code path.

Credit to OSS-Fuzz
2023-08-25 13:21:58 -04:00
Nick Terrell
c27fa39904 Work around nullptr-with-nonzero-offset warning
See comment.
2023-08-25 13:20:59 -04:00
Dmitry V. Levin
ecb86d8286 zdictlib: fix prototype mismatch
Fix the following warnings reported by the compiler when
ZDICTLIB_STATIC_API is not defined to ZDICTLIB_API:

lib/dictBuilder/cover.c:1122:21: warning: redeclaration of 'ZDICT_optimizeTrainFromBuffer_cover' with different visibility (old visibility
preserved)
lib/dictBuilder/cover.c:736:21: warning: redeclaration of 'ZDICT_trainFromBuffer_cover' with different visibility (old visibility
+preserved)
lib/dictBuilder/fastcover.c:549:1: warning: redeclaration of 'ZDICT_trainFromBuffer_fastCover' with different visibility (old visibility
preserved)
lib/dictBuilder/fastcover.c:618:1: warning: redeclaration of 'ZDICT_optimizeTrainFromBuffer_fastCover' with different visibility (old
visibility preserved)
2023-08-23 08:00:00 +00:00
Yann Collet
0fcb28c5d2
Merge pull request #3720 from QBos07/cygwin-msys2-support
Updated Makefiles for full MSYS2 and Cygwin installation and testing …
2023-08-22 16:29:34 -07:00
Yann Collet
59af58762a
Merge pull request #3728 from 0o001/dev
fix: ZSTD_BUILD_DECOMPRESSION message
2023-08-22 13:33:47 -07:00
Nick Terrell
bd02c9be6e No longer reject dictionaries with literals maxSymbolValue < 255
We already have logic in our Huffman encoder to validate Huffman tables with missing symbols.
We use this for higher compression levels to re-use the previous blocks statistics, or when the dictionaries table has zero-weighted symbols.
This check was leftover as an oversight from before we added validation for Huffman tables.

I validated that the `dictionary_loader` fuzzer has coverage of every line in the `ZSTD_loadCEntropy()` function to validate that it is correctly testing this function.
2023-08-22 13:22:35 -04:00
Yann Collet
9662fe1683
Merge pull request #3726 from facebook/fullbench_dctx
added ZSTD_decompressDCtx() benchmark option to fullbench
2023-08-21 12:35:51 -07:00
Felix Handte
edb6e8f427
Merge pull request #3730 from facebook/dependabot/github_actions/github/codeql-action-2.21.4
Bump github/codeql-action from 2.20.3 to 2.21.4
2023-08-21 09:47:26 -07:00
dependabot[bot]
db0ae65436
Bump github/codeql-action from 2.20.3 to 2.21.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.20.3 to 2.21.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](46ed16ded9...a09933a12a)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 05:51:56 +00:00
Mustafa UZUN
a02d81f944 fix: ZSTD_BUILD_DECOMPRESSION message 2023-08-19 15:44:53 +03:00
Yann Collet
a07d7c4e29 added ZSTD_decompressDCtx() benchmark option to fullbench
useful to compare the difference between ZSTD_decompress
and ZSTD_decompressDCtx().
2023-08-16 10:43:39 -07:00
Felix Handte
3298a08076
Merge pull request #3725 from felixhandte/msan-unpoison-cwksp-on-free
Unpoison Workspace Memory Before Custom-Free
2023-08-16 10:18:31 -07:00