]> git.ipfire.org Git - thirdparty/zstd.git/log
thirdparty/zstd.git
2 years agoFix Permissions on Publish Release Artifacts Job 3511/head
W. Felix Handte [Wed, 15 Feb 2023 15:48:21 +0000 (10:48 -0500)] 
Fix Permissions on Publish Release Artifacts Job

Publishing release artifacts requires the `contents` permission, as documented
by: https://docs.github.com/en/rest/overview/permissions-required-for-github-apps.

2 years agoCI workflow to test external compressors dependencies
Yonatan Komornik [Tue, 14 Feb 2023 02:00:13 +0000 (18:00 -0800)] 
CI workflow to test external compressors dependencies

Implemented CI workflow for testing compilation with external compressors and without them. This serves as a sanity check to avoid any code dependencies on libraries that may not always be present. (Reference: #3497 for a bug fix related to this issue.)

2 years agoMake Github workflows permissions read-only by default (#3488)
Yonatan Komornik [Tue, 14 Feb 2023 00:57:05 +0000 (16:57 -0800)] 
Make Github workflows permissions read-only by default (#3488)

* Make Github workflows permissions read-only by default

* Pins `skx/github-action-publish-binaries` action to specific hash

2 years agoUse correct types in LZMA comp/decomp (#3497)
Alex Xu [Tue, 14 Feb 2023 00:30:56 +0000 (00:30 +0000)] 
Use correct types in LZMA comp/decomp (#3497)

Bytef and uInt are zlib types, not available when zlib is disabled

Fixes: 1598e6c634ac ("Async write for decompression")
Fixes: cc0657f27d81 ("AsyncIO compression part 2 - added async read and asyncio to compression code (#3022)")
2 years agoMerge pull request #3491 from facebook/win_artifacts
Yann Collet [Mon, 13 Feb 2023 19:30:47 +0000 (11:30 -0800)] 
Merge pull request #3491 from facebook/win_artifacts

Github Action to generate Win64 artifacts

2 years agoBump github/codeql-action from 2.2.1 to 2.2.4 (#3503)
dependabot[bot] [Mon, 13 Feb 2023 11:35:31 +0000 (06:35 -0500)] 
Bump github/codeql-action from 2.2.1 to 2.2.4 (#3503)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.1 to 2.2.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/3ebbd71c74ef574dbc558c82f70e52732c8b44fe...17573ee1cc1b9d061760f3a006fc4aac4f944fd5)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoFix zstd-dll build missing dependencies (#3496)
Yonatan Komornik [Sun, 12 Feb 2023 20:32:31 +0000 (12:32 -0800)] 
Fix zstd-dll build missing dependencies (#3496)

* Fixes zstd-dll build (https://github.com/facebook/zstd/issues/3492):
- Adds pool.o and threading.o dependency to the zstd-dll target
- Moves custom allocation functions into header to avoid needing to add dependency on common.o
- Adds test target for zstd-dll
- Adds github workflow that buildis zstd-dll

2 years agoFix all MSVC warnings (#3495)
Elliot Gorokhovsky [Sat, 11 Feb 2023 15:56:59 +0000 (10:56 -0500)] 
Fix all MSVC warnings (#3495)

* fix and test MSVC AVX2 build

* treat msbuild warnings as errors

* fix incorrect MSVC 2019 compiler warning

* fix MSVC error D9035: option 'Gm' has been deprecated and will be removed in a future release

2 years agotry a different compiler 3491/head
Yann Collet [Sat, 11 Feb 2023 04:49:21 +0000 (20:49 -0800)] 
try a different compiler

2 years agosimplify win64 artifact generation
Yann Collet [Sat, 11 Feb 2023 00:58:54 +0000 (16:58 -0800)] 
simplify win64 artifact generation

2 years agomove shell to mingw
Yann Collet [Fri, 10 Feb 2023 22:27:47 +0000 (14:27 -0800)] 
move shell to mingw

2 years agoGithub Action to generate Win64 artifacts
Yann Collet [Fri, 10 Feb 2023 06:48:30 +0000 (22:48 -0800)] 
Github Action to generate Win64 artifacts

2 years agominor nit updates to README.md 3487/head
Yann Collet [Thu, 9 Feb 2023 23:51:18 +0000 (15:51 -0800)] 
minor nit updates to README.md

2 years agoupdated man pages
Yann Collet [Thu, 9 Feb 2023 22:40:39 +0000 (14:40 -0800)] 
updated man pages

2 years agoRename "External Matchfinder" to "Block-Level Sequence Producer" (#3484)
Elliot Gorokhovsky [Thu, 9 Feb 2023 22:01:17 +0000 (17:01 -0500)] 
Rename "External Matchfinder" to "Block-Level Sequence Producer" (#3484)

* change "external matchfinder" to "external sequence producer"

* migrate contrib/ to new naming convention

* fix contrib build

* fix error message

* update debug strings

* fix def of invalid sequences in zstd.h

* nit

* update CHANGELOG

* fix .gitignore

2 years agoupdated CHANGELOG in preparation for v1.5.4 release
Yann Collet [Thu, 9 Feb 2023 00:35:55 +0000 (16:35 -0800)] 
updated CHANGELOG in preparation for v1.5.4 release

2 years agoMerge branch 'dev' of github.com:facebook/zstd into dev
Yann Collet [Wed, 8 Feb 2023 23:57:12 +0000 (15:57 -0800)] 
Merge branch 'dev' of github.com:facebook/zstd into dev

2 years agominor: fix missing newline character in help page
Yann Collet [Wed, 8 Feb 2023 23:56:49 +0000 (15:56 -0800)] 
minor: fix missing newline character in help page

2 years agoFix empty-block.zst golden decompression file
Nick Terrell [Wed, 8 Feb 2023 19:42:46 +0000 (11:42 -0800)] 
Fix empty-block.zst golden decompression file

This frame is invalid because the `Window_Size = 0`, and the
`Block_Maximum_Size = min(128 KB, Window_Size) = 0`. But the empty
compressed block has a `Block_Content` size of 2, which is invalid.

The fix is to switch to using a `Window_Descriptor` instead of the
`Single_Segment_Flag`. This sets the `Window_Size = 1024`.

Hexdump before this PR: `28b5 2ffd 2000 1500 0000 00`

Hexdump after this PR: `28b5 2ffd 0000 1500 0000 00`

For issue #3482.

2 years agoMerge pull request #3476 from facebook/fix55714
Yann Collet [Wed, 8 Feb 2023 02:06:22 +0000 (18:06 -0800)] 
Merge pull request #3476 from facebook/fix55714

fix oss-fuzz case 55714

2 years agorewrite legacy v0.7 bound checks to be independent of address space overflow 3476/head
Yann Collet [Wed, 8 Feb 2023 01:11:07 +0000 (17:11 -0800)] 
rewrite legacy v0.7 bound checks to be independent of address space overflow

2 years agoadd requested check for legacy decoder v0.1
Yann Collet [Tue, 7 Feb 2023 22:47:16 +0000 (14:47 -0800)] 
add requested check for legacy decoder v0.1

which uses a different technique to store literals,
and therefore must check for potential overwrites.

2 years agofix legacy decoders v0.4, v0.5 and v0.6
Yann Collet [Tue, 7 Feb 2023 22:02:12 +0000 (14:02 -0800)] 
fix legacy decoders v0.4, v0.5 and v0.6

2 years agoport fix for v0.3 to v0.6
Yann Collet [Tue, 7 Feb 2023 04:43:09 +0000 (20:43 -0800)] 
port fix for v0.3 to v0.6

in case it would applicable for this version

2 years agoport fix for v0.3 to v0.5
Yann Collet [Tue, 7 Feb 2023 04:40:29 +0000 (20:40 -0800)] 
port fix for v0.3 to v0.5

in case it would be applicable for this version too

2 years agocopy fix for v0.3 to v0.4
Yann Collet [Tue, 7 Feb 2023 04:36:37 +0000 (20:36 -0800)] 
copy fix for v0.3 to v0.4

in case it would be applicable for this legacy version too.

2 years agoadapt v0.3 fix to v0.1
Yann Collet [Tue, 7 Feb 2023 04:33:38 +0000 (20:33 -0800)] 
adapt v0.3 fix to v0.1

slightly different constraints on end of buffer conditions

2 years agofix for v0.3 blindly ported to v0.2
Yann Collet [Tue, 7 Feb 2023 04:26:25 +0000 (20:26 -0800)] 
fix for v0.3 blindly ported to v0.2

in case it would be applicable here too.

2 years agofix oss-fuzz case 55714
Yann Collet [Tue, 7 Feb 2023 04:20:01 +0000 (20:20 -0800)] 
fix oss-fuzz case 55714

impacts legacy decoder v0.3 in 32-bit mode

2 years agoMerge pull request #3480 from facebook/benchFail
Yann Collet [Tue, 7 Feb 2023 20:42:47 +0000 (12:42 -0800)] 
Merge pull request #3480 from facebook/benchFail

return error code when benchmark fails

2 years agoadd error message for the (rare) compression error scenario 3480/head
Yann Collet [Tue, 7 Feb 2023 18:02:09 +0000 (10:02 -0800)] 
add error message for the (rare) compression error scenario

2 years agoadded more accurate error messages
Yann Collet [Tue, 7 Feb 2023 16:47:39 +0000 (08:47 -0800)] 
added more accurate error messages

for the decompression-only benchmark mode.

2 years agoreturn error code when benchmark fails
Yann Collet [Tue, 7 Feb 2023 08:35:51 +0000 (00:35 -0800)] 
return error code when benchmark fails

such scenario can happen, for example,
when trying a decompression-only benchmark on invalid data.
Other possibilities include an allocation error in an intermediate step.

So far, the benchmark would return immediately, but still return 0.
On command line, this would be confusing, as the program appears successful (though it does not display any successful message).

Now it returns !0, which can be interpreted as an error by command line.

2 years agoMerge pull request #3477 from facebook/dependabot/github_actions/ilammy/msvc-dev...
Felix Handte [Mon, 6 Feb 2023 18:04:21 +0000 (13:04 -0500)] 
Merge pull request #3477 from facebook/dependabot/github_actions/ilammy/msvc-dev-cmd-1.12.1

Bump ilammy/msvc-dev-cmd from 1.12.0 to 1.12.1

2 years agoBump ilammy/msvc-dev-cmd from 1.12.0 to 1.12.1 3477/head
dependabot[bot] [Mon, 6 Feb 2023 05:12:10 +0000 (05:12 +0000)] 
Bump ilammy/msvc-dev-cmd from 1.12.0 to 1.12.1

Bumps [ilammy/msvc-dev-cmd](https://github.com/ilammy/msvc-dev-cmd) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/ilammy/msvc-dev-cmd/releases)
- [Commits](https://github.com/ilammy/msvc-dev-cmd/compare/7315a94840631165970262a99c72cfb48a65d25d...cec98b9d092141f74527d0afa6feb2af698cfe89)

---
updated-dependencies:
- dependency-name: ilammy/msvc-dev-cmd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoAsyncIO performance regression for small files fix (#3474)
Yonatan Komornik [Thu, 2 Feb 2023 23:19:22 +0000 (15:19 -0800)] 
AsyncIO performance regression for small files fix (#3474)

- Do not use threaded AsyncIO when handling small files.
- Some typo / doc fixes

2 years agoFix ZSTD_getOffsetInfo() when nbSeq == 0
Nick Terrell [Thu, 2 Feb 2023 18:53:08 +0000 (10:53 -0800)] 
Fix ZSTD_getOffsetInfo() when nbSeq == 0

In 32-bit mode, ZSTD_getOffsetInfo() can be called when nbSeq == 0, and
in this case the offset table is uninitialized. The function should just
return 0 for both values, because there are no sequences.

Credit to OSS-Fuzz

2 years agoMerge pull request #3471 from embg/fast_seq_parse
Elliot Gorokhovsky [Thu, 2 Feb 2023 02:30:36 +0000 (21:30 -0500)] 
Merge pull request #3471 from embg/fast_seq_parse

Reduce external matchfinder API overhead by 25%

2 years agoassert externalRepSearch != ZSTD_ps_auto 3471/head
Elliot Gorokhovsky [Thu, 2 Feb 2023 02:24:46 +0000 (18:24 -0800)] 
assert externalRepSearch != ZSTD_ps_auto

2 years agoMerge pull request #3472 from terrelln/2023-02-01-fix-32-bit-decoding
Yann Collet [Thu, 2 Feb 2023 01:52:03 +0000 (17:52 -0800)] 
Merge pull request #3472 from terrelln/2023-02-01-fix-32-bit-decoding

Fix 32-bit decoding with large dictionary

2 years agoFix 32-bit decoding with large dictionary 3472/head
Nick Terrell [Thu, 2 Feb 2023 00:38:36 +0000 (16:38 -0800)] 
Fix 32-bit decoding with large dictionary

The 32-bit decoder could corrupt the regenerated data by using regular
offset mode when there were actually long offsets. This is because we
were only considering the window size in the calculation, not the
dictionary size. So a large dictionary could allow longer offsets.

Fix this in two ways:
1. Instead of looking at the window size, look at the total referencable
   bytes in the history buffer. Use this in the comparison instead of
   the window size. Additionally, we were comparing against the wrong
   value, it was too low. Fix that by computing exactly the maximum
   offset for regular sequence decoding.
2. If it is possible that we have long offsets due to (1), then check
   the offset code decoding table, and if the decoding table's maximum
   number of additional bits is no more than STREAM_ACCUMULATOR_MIN,
   then we can't have long offsets.

This gates us to be using the long offsets decoder only when we are very
likely to actually have long offsets.

Note that this bug only affects the decoding of the data, and the
original compressed data, if re-read with a patched decoder, will
correctly regenerate the orginal data. Except that the encoder also had
the same issue previously.

This fixes both the open OSS-Fuzz issues.

Credit to OSS-Fuzz

2 years agoadd ZSTD_c_fastExternalSequenceParsing cctxParam
Elliot Gorokhovsky [Tue, 31 Jan 2023 21:51:32 +0000 (13:51 -0800)] 
add ZSTD_c_fastExternalSequenceParsing cctxParam

2 years agoMerge pull request #3470 from facebook/bench_zstd_only
Yann Collet [Wed, 1 Feb 2023 00:22:20 +0000 (16:22 -0800)] 
Merge pull request #3470 from facebook/bench_zstd_only

ensure that benchmark mode can only be invoked with zstd format

2 years agoGuard against invalid sequences from external matchfinders (#3465)
Elliot Gorokhovsky [Tue, 31 Jan 2023 18:55:48 +0000 (13:55 -0500)] 
Guard against invalid sequences from external matchfinders (#3465)

2 years agoensure that benchmark mode can only be invoked with zstd format 3470/head
Yann Collet [Tue, 31 Jan 2023 16:59:27 +0000 (08:59 -0800)] 
ensure that benchmark mode can only be invoked with zstd format

fix #3463

2 years agoMerge pull request #3469 from facebook/updateVersion
Yann Collet [Tue, 31 Jan 2023 03:58:22 +0000 (19:58 -0800)] 
Merge pull request #3469 from facebook/updateVersion

bump version number to v1.5.4

2 years agoMerge pull request #3464 from facebook/dependabot/github_actions/github/codeql-action...
Yann Collet [Tue, 31 Jan 2023 03:07:33 +0000 (19:07 -0800)] 
Merge pull request #3464 from facebook/dependabot/github_actions/github/codeql-action-2.2.1

Bump github/codeql-action from 2.1.39 to 2.2.1

2 years agobump version number to v1.5.4 3469/head
Yann Collet [Tue, 31 Jan 2023 03:06:39 +0000 (19:06 -0800)] 
bump version number to v1.5.4

start preparation for release

2 years agoSimplify 32-bit long offsets decoding logic
Nick Terrell [Mon, 30 Jan 2023 19:15:15 +0000 (11:15 -0800)] 
Simplify 32-bit long offsets decoding logic

The previous code had an issue when `bitsConsumed == 32` it would read 0
bits for the `ofBits` read, which violates the precondition of
`BIT_readBitsFast()`. This can happen when the stream is corrupted.

Fix thie issue by always reading the maximum possible number of extra
bits. I've measured neutral decoding performance, likely because this
branch is unlikely, but this should be faster anyways. And if not, it is
only 32-bit decoding, so performance isn't as critical.

Credit to OSS-Fuzz

2 years agoMerge pull request #3460 from daniellerozenblit/fix-long-offsets-resolution-pointer
daniellerozenblit [Mon, 30 Jan 2023 19:02:51 +0000 (14:02 -0500)] 
Merge pull request #3460 from daniellerozenblit/fix-long-offsets-resolution-pointer

fix long offset resolution

2 years agoMerge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit... 3460/head
Danielle Rozenblit [Mon, 30 Jan 2023 14:26:21 +0000 (06:26 -0800)] 
Merge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit/zstd into fix-long-offsets-resolution-pointer

2 years agoremove big test around large offset with small window size
Danielle Rozenblit [Mon, 30 Jan 2023 14:26:03 +0000 (06:26 -0800)] 
remove big test around large offset with small window size

2 years agoBump github/codeql-action from 2.1.39 to 2.2.1 3464/head
dependabot[bot] [Mon, 30 Jan 2023 05:11:42 +0000 (05:11 +0000)] 
Bump github/codeql-action from 2.1.39 to 2.2.1

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.39 to 2.2.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/a34ca99b4610d924e04c68db79e503e1f79f9f02...3ebbd71c74ef574dbc558c82f70e52732c8b44fe)

---
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>
2 years agoUpdate .github/workflows/dev-long-tests.yml
daniellerozenblit [Sat, 28 Jan 2023 17:14:48 +0000 (12:14 -0500)] 
Update .github/workflows/dev-long-tests.yml

Co-authored-by: Nick Terrell <nickrterrell@gmail.com>
2 years agoFix invalid assert in 32-bit decoding
Nick Terrell [Fri, 27 Jan 2023 19:14:56 +0000 (11:14 -0800)] 
Fix invalid assert in 32-bit decoding

The assert is only correct for valid sequences, so disable it for
everything execpt round trip fuzzers.

2 years agoMerge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit...
Danielle Rozenblit [Fri, 27 Jan 2023 22:18:44 +0000 (14:18 -0800)] 
Merge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit/zstd into fix-long-offsets-resolution-pointer

2 years agoupdate CI
Danielle Rozenblit [Fri, 27 Jan 2023 22:18:29 +0000 (14:18 -0800)] 
update CI

2 years agoUpdate lib/compress/zstd_compress.c
daniellerozenblit [Fri, 27 Jan 2023 21:58:53 +0000 (16:58 -0500)] 
Update lib/compress/zstd_compress.c

Co-authored-by: Nick Terrell <nickrterrell@gmail.com>
2 years ago[fse] Delete unused functions
Nick Terrell [Fri, 27 Jan 2023 19:59:26 +0000 (11:59 -0800)] 
[fse] Delete unused functions

Delete all unused FSE functions, now that we are no longer syncing
to/from upstream.

This avoids confusion about Zstd's stack usage like in Issue #3453.
It also removes dead code, which is always a plus.

2 years agorecord long offsets in ZSTD_symbolEncodingTypeStats_t + add test case
Danielle Rozenblit [Fri, 27 Jan 2023 20:04:29 +0000 (12:04 -0800)] 
record long offsets in ZSTD_symbolEncodingTypeStats_t + add test case

2 years agoinitialize long offsets in decodecorpus
Danielle Rozenblit [Fri, 27 Jan 2023 17:52:00 +0000 (09:52 -0800)] 
initialize long offsets in decodecorpus

2 years agofix long offset resolution
Danielle Rozenblit [Fri, 27 Jan 2023 16:21:47 +0000 (08:21 -0800)] 
fix long offset resolution

2 years agoMerge pull request #3458 from facebook/stderr_finalStatus
Yann Collet [Fri, 27 Jan 2023 01:22:38 +0000 (17:22 -0800)] 
Merge pull request #3458 from facebook/stderr_finalStatus

Update logic when `stderr` is not the console

2 years ago[huf] Fix bug in fast C decoders
Nick Terrell [Thu, 26 Jan 2023 20:11:25 +0000 (12:11 -0800)] 
[huf] Fix bug in fast C decoders

The input bounds checks were buggy because they were only breaking from
the inner loop, not the outer loop. The fuzzers found this immediately.
The fix is to use `goto _out` instead of `break`.

This condition can happen on corrupted inputs.

I've benchmarked before and after on x86-64 and there were small changes
in performance, some positive, and some negative, and they end up about
balacing out.

Credit to  OSS-Fuzz

2 years agochange logic when stderr is not console : don't update progress status 3458/head
Yann Collet [Thu, 26 Jan 2023 19:43:27 +0000 (11:43 -0800)] 
change logic when stderr is not console : don't update progress status

but keep warnings and final operation statement.

updated tests/cli-tests/ accordingly

2 years agomodify cli-test logic : ignore stderr message by default
Yann Collet [Thu, 26 Jan 2023 00:29:34 +0000 (16:29 -0800)] 
modify cli-test logic : ignore stderr message by default

Previously, cli-test would, by default, check that a stderr output is strictly identical to a saved outcome.
When there was no instructions on how to interpret stderr, it would default to requiring it to be empty.

There are many tests cases though where stderr content doesn't matter, and we are mainly interested in the return code of the cli.
For these cases, it was possible to set a .ignore document, which would instruct to ignore stderr content.

This PR update the logic, to make .ignore the default.
When willing to check that stderr content is empty, one must now add an empty .strict file.

This will allow status message to evolve without triggering many cli-tests errors.
This is especially important when some of these status include compression results, which may change as a result of compression optimizations.
It also makes it easier to add new tests which only care about the CLI's return code.

2 years agoMerge pull request #3457 from yoniko/fix-rowhash-cli
Yonatan Komornik [Thu, 26 Jan 2023 06:40:25 +0000 (22:40 -0800)] 
Merge pull request #3457 from yoniko/fix-rowhash-cli

[Bugfix] CLI row hash flags set the wrong values

`--[no-]row-match-finder` do the opposite of what they are supposed to.
In effect the no option would activate row hash while the other option will disable it.
This commit fixes the issue and changes the code to use the more readable enum values.

2 years agoBugfix: `--[no-]row-match-finder` do the opposite of what they are supposed to 3457/head
Yonatan Komornik [Thu, 26 Jan 2023 01:59:35 +0000 (17:59 -0800)] 
Bugfix: `--[no-]row-match-finder` do the opposite of what they are supposed to

2 years agoMerge pull request #3450 from facebook/no_rm_on_o
Yann Collet [Thu, 26 Jan 2023 01:51:53 +0000 (17:51 -0800)] 
Merge pull request #3450 from facebook/no_rm_on_o

disable --rm on -o command

2 years agoenforce a hard fail when input files are set to be erased 3450/head
Yann Collet [Thu, 26 Jan 2023 00:18:20 +0000 (16:18 -0800)] 
enforce a hard fail when input files are set to be erased

in scenarios where it's supposed to not be possible.

suggested by @terrelln

2 years agodisable --rm on -o command
Yann Collet [Tue, 24 Jan 2023 02:55:51 +0000 (18:55 -0800)] 
disable --rm on -o command

make it more similar to -c (aka `stdout`) convention.

2 years agoMerge pull request #3455 from facebook/fix3454
Yann Collet [Wed, 25 Jan 2023 23:22:51 +0000 (15:22 -0800)] 
Merge pull request #3455 from facebook/fix3454

Provide more accurate error codes for busy-loop scenarios

2 years ago[version-test] Work around bugs in v0.7.3 dict builder
Nick Terrell [Tue, 24 Jan 2023 04:23:43 +0000 (20:23 -0800)] 
[version-test] Work around bugs in v0.7.3 dict builder

Before calling a dictionary good, make sure that it can compress an
input. If v0.7.3 rejects v0.7.3's dictionary, fall back to the v1.0
dictionary. This is not the job of the verison test to test it, because
we cannot fix this code.

2 years ago[huf] Add generic C versions of the fast decoding loops
Nick Terrell [Sat, 14 Jan 2023 00:34:52 +0000 (16:34 -0800)] 
[huf] Add generic C versions of the fast decoding loops

Add generic C versions of the fast decoding loops to serve architectures
that don't have an assembly implementation. Also allow selecting the C
decoding loop over the assembly decoding loop through a zstd
decompression parameter `ZSTD_d_disableHuffmanAssembly`.

I benchmarked on my Intel i9-9900K and my Macbook Air with an M1 processor.
The benchmark command forces zstd to compress without any matches, using
only literals compression, and measures only Huffman decompression speed:

```
zstd -b1e1 --compress-literals --zstd=tlen=131072 silesia.tar
```

The new fast decoding loops outperform the previous implementation uniformly,
but don't beat the x86-64 assembly. Additionally, the fast C decoding loops suffer
from the same stability problems that we've seen in the past, where the assembly
version doesn't. So even though clang gets close to assembly on x86-64, it still
has stability issues.

| Arch    | Function       | Compiler     | Default (MB/s) | Assembly (MB/s) | Fast (MB/s) |
|---------|----------------|--------------|----------------|-----------------|-------------|
| x86-64  | decompress 4X1 | gcc-12.2.0   |         1029.6 |          1308.1 |      1208.1 |
| x86-64  | decompress 4X1 | clang-14.0.6 |         1019.3 |          1305.6 |      1276.3 |
| x86-64  | decompress 4X2 | gcc-12.2.0   |         1348.5 |          1657.0 |      1374.1 |
| x86-64  | decompress 4X2 | clang-14.0.6 |         1027.6 |          1659.9 |      1468.1 |
| aarch64 | decompress 4X1 | clang-12.0.5 |         1081.0 |             N/A |      1234.9 |
| aarch64 | decompress 4X2 | clang-12.0.5 |         1270.0 |             N/A |      1516.6 |

2 years agoProvide more accurate error codes for busy-loop scenarios 3455/head
Yann Collet [Wed, 25 Jan 2023 21:07:53 +0000 (13:07 -0800)] 
Provide more accurate error codes for busy-loop scenarios

fixes #3454

2 years agoMerge pull request #3447 from daniellerozenblit/fuzz-sequence-compression
daniellerozenblit [Wed, 25 Jan 2023 14:27:34 +0000 (09:27 -0500)] 
Merge pull request #3447 from daniellerozenblit/fuzz-sequence-compression

Fuzz large offsets through sequence compression api

2 years agoMerge pull request #3452 from daniellerozenblit/fix-seekable-32bit
daniellerozenblit [Wed, 25 Jan 2023 14:23:34 +0000 (09:23 -0500)] 
Merge pull request #3452 from daniellerozenblit/fix-seekable-32bit

Fix 32-bit build errors in zstd seekable format

2 years agofix 32bit build errors in zstd seekable 3452/head
Danielle Rozenblit [Tue, 24 Jan 2023 23:53:59 +0000 (15:53 -0800)] 
fix 32bit build errors in zstd seekable

2 years agoMerge pull request #3451 from yoniko/red-zones-bugfix
Yonatan Komornik [Tue, 24 Jan 2023 22:32:56 +0000 (14:32 -0800)] 
Merge pull request #3451 from yoniko/red-zones-bugfix

Bugfix redzone unpoisoning

2 years agoBug fix redzones by unpoisoning only the intended buffer and not the followup redzone. 3451/head
Yonatan Komornik [Tue, 24 Jan 2023 20:54:43 +0000 (12:54 -0800)] 
Bug fix redzones by unpoisoning only the intended buffer and not the followup redzone.

2 years agofix bound check for ZSTD_copySequencesToSeqStoreNoBlockDelim() 3447/head
Danielle Rozenblit [Tue, 24 Jan 2023 14:40:40 +0000 (06:40 -0800)] 
fix bound check for ZSTD_copySequencesToSeqStoreNoBlockDelim()

2 years agoMerge pull request #3448 from facebook/embg-doc-fix
Elliot Gorokhovsky [Mon, 23 Jan 2023 20:04:53 +0000 (15:04 -0500)] 
Merge pull request #3448 from facebook/embg-doc-fix

Fix ZSTD_estimate* and ZSTD_initCStream() docs

2 years agoMerge branch 'dev' into fuzz-sequence-compression
Danielle Rozenblit [Mon, 23 Jan 2023 19:11:33 +0000 (11:11 -0800)] 
Merge branch 'dev' into fuzz-sequence-compression
for testing

2 years agoMerge pull request #3439 from daniellerozenblit/sequence-validation-bug-fix
daniellerozenblit [Mon, 23 Jan 2023 18:50:37 +0000 (13:50 -0500)] 
Merge pull request #3439 from daniellerozenblit/sequence-validation-bug-fix

Fix sequence validation and seqStore bounds check

2 years agocalloc dictionary in sequence compression fuzzer rather than generating a random...
Danielle Rozenblit [Mon, 23 Jan 2023 18:42:09 +0000 (10:42 -0800)] 
calloc dictionary in sequence compression fuzzer rather than generating a random buffer

2 years agoFix ZSTD_estimate* and ZSTD_initCStream() docs 3448/head
Elliot Gorokhovsky [Mon, 23 Jan 2023 18:28:36 +0000 (13:28 -0500)] 
Fix ZSTD_estimate* and ZSTD_initCStream() docs

Fix the following documentation bugs:
* Note that `ZSTD_estimate*` functions are not compatible with the external matchfinder API
* Note that `ZSTD_estimateCStreamSize_usingCCtxParams()` is not compatible with `nbWorkers >= 1`
* Remove incorrect warning that the legacy streaming API is incompatible with advanced parameters and/or dictionary compression
* Note that `ZSTD_initCStream()` is incompatible with dictionary compression
* Warn that

2 years agoMerge pull request #3443 from facebook/no_rm_w_stdout
Yann Collet [Mon, 23 Jan 2023 18:22:11 +0000 (10:22 -0800)] 
Merge pull request #3443 from facebook/no_rm_w_stdout

refactor : --rm ignored with stdout

2 years agoFix -Wstringop-overflow warning
Nick Terrell [Fri, 20 Jan 2023 19:29:52 +0000 (11:29 -0800)] 
Fix -Wstringop-overflow warning

Backported from kernel patch [0].

I wasn't able to reproduce the warning locally, but could repro it in
the kernel.

[0] https://lore.kernel.org/lkml/20220330193352.GA119296@embeddedor/

2 years agoupdate external sequence error to fit error naming scheme 3439/head
Danielle Rozenblit [Mon, 23 Jan 2023 17:58:34 +0000 (09:58 -0800)] 
update external sequence error to fit error naming scheme

2 years agoMerge pull request #3446 from facebook/dependabot/github_actions/github/codeql-action...
Elliot Gorokhovsky [Mon, 23 Jan 2023 16:55:13 +0000 (11:55 -0500)] 
Merge pull request #3446 from facebook/dependabot/github_actions/github/codeql-action-2.1.39

Bump github/codeql-action from 2.1.38 to 2.1.39

2 years agomerge dev
Danielle Rozenblit [Mon, 23 Jan 2023 16:12:19 +0000 (08:12 -0800)] 
merge dev

2 years agofix nits and add new error code for invalid external sequences
Danielle Rozenblit [Mon, 23 Jan 2023 15:59:02 +0000 (07:59 -0800)] 
fix nits and add new error code for invalid external sequences

2 years agomodify sequence compression api fuzzer
Danielle Rozenblit [Mon, 23 Jan 2023 15:55:11 +0000 (07:55 -0800)] 
modify sequence compression api fuzzer

2 years agoBump github/codeql-action from 2.1.38 to 2.1.39 3446/head
dependabot[bot] [Mon, 23 Jan 2023 05:10:26 +0000 (05:10 +0000)] 
Bump github/codeql-action from 2.1.38 to 2.1.39

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.38 to 2.1.39.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/515828d97454b8354517688ddc5b48402b723750...a34ca99b4610d924e04c68db79e503e1f79f9f02)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoupdate man 3443/head
Yann Collet [Sat, 21 Jan 2023 02:07:55 +0000 (18:07 -0800)] 
update man

2 years agorefactor : --rm is ignored with stdout
Yann Collet [Sat, 21 Jan 2023 01:53:05 +0000 (17:53 -0800)] 
refactor : --rm is ignored with stdout

`zstd` CLI has progressively moved to the policy of
ignoring `--rm` command when the output is `stdout`.
The primary drive is to feature a behavior more consistent with `gzip`,
when `--rm` is the default, but is also ignored when output is `stdout`.
Other policies are certainly possible, but would break from this `gzip` convention.

The new policy was inconsistenly enforced, depending on the exact list of commands.
For example, it was possible to circumvent it by using `-c --rm` in this order,
which would re-establish source removal.

- Update the CLI so that it necessarily catch these situations and ensure that `--rm` is always disabled when output is `stdout`.
- Added a warning message in this case (for verbosity 3 `-v`).
- Added an `assert()`, which controls that `--rm` is no longer active with `stdout`
- Added tests, which control the behavior, even when `--rm` is added after `-c`
- Removed some legacy code which where trying to apply a specific policy for the `stdout` + `--rm` case, which is no longer possible

2 years agofixed minor c89 warning
Yann Collet [Sat, 21 Jan 2023 02:04:20 +0000 (18:04 -0800)] 
fixed minor c89 warning

introduced due to parallel merges

2 years agoMerge pull request #3432 from felixhandte/fix-perms
Felix Handte [Sat, 21 Jan 2023 00:19:05 +0000 (19:19 -0500)] 
Merge pull request #3432 from felixhandte/fix-perms

Fix CLI Handling of Permissions and Ownership (Again)

2 years agoMerge pull request #3442 from felixhandte/pgo-tests
Felix Handte [Sat, 21 Jan 2023 00:18:51 +0000 (19:18 -0500)] 
Merge pull request #3442 from felixhandte/pgo-tests

Test PGO Builds

2 years agoFix bufferless API with attached dictionary
Nick Terrell [Fri, 20 Jan 2023 22:14:14 +0000 (14:14 -0800)] 
Fix bufferless API with attached dictionary

Fixes #3102.