]> git.ipfire.org Git - thirdparty/zstd.git/log
thirdparty/zstd.git
2 years agoProvide an interface for fuzzing sequence producer plugins 3551/head
Elliot Gorokhovsky [Tue, 14 Mar 2023 16:40:53 +0000 (09:40 -0700)] 
Provide an interface for fuzzing sequence producer plugins

2 years agoAdd init once memory (#3528) (#3529)
Yonatan Komornik [Mon, 13 Mar 2023 20:20:49 +0000 (13:20 -0700)] 
Add init once memory (#3528) (#3529)

- Adds memory type that is guaranteed to have been initialized at least once in the workspace's lifetime.
- Changes tag space in row hash to be based on init once memory.

2 years agoBump github/codeql-action from 2.2.5 to 2.2.6 (#3549)
dependabot[bot] [Mon, 13 Mar 2023 17:07:20 +0000 (10:07 -0700)] 
Bump github/codeql-action from 2.2.5 to 2.2.6 (#3549)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.5 to 2.2.6.
- [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/32dc499307d133bb5085bae78498c0ac2cf762d5...16964e90ba004cdf0cd845b866b5df21038b7723)

---
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 ago[Bugfix] row hash tries to match position 0 (#3548)
Yonatan Komornik [Mon, 13 Mar 2023 17:00:03 +0000 (10:00 -0700)] 
[Bugfix] row hash tries to match position 0 (#3548)

#3543 decreases the size of the tagTable by a factor of 2, which requires using the first tag position in each row for head position instead of a tag.
Although position 0 stopped being a valid match, it still persisted in mask calculation resulting in the matches loops possibly terminating before it should have. The fix skips position 0 to solve this problem.

2 years agoReduce RowHash's tag space size by x2 (#3543)
Yonatan Komornik [Fri, 10 Mar 2023 22:15:04 +0000 (14:15 -0800)] 
Reduce RowHash's tag space size by x2 (#3543)

Allocate half the memory for tag space, which means that we get one less slot for an actual tag (needs to be used for next position index).
The results is a slight loss in compression ratio (up to 0.2%) and some regressions/improvements to speed depending on level and sample. In turn, we get to save 16% of the hash table's space (5 bytes per entry instead of 6 bytes per entry).

2 years agoMerge pull request #3544 from facebook/seek_faster
Yann Collet [Fri, 10 Mar 2023 20:33:33 +0000 (12:33 -0800)] 
Merge pull request #3544 from facebook/seek_faster

Improved seekable format ingestion speed for small frame size

2 years agoImproved seekable format ingestion speed for small frame size 3544/head
Yann Collet [Fri, 10 Mar 2023 01:48:35 +0000 (17:48 -0800)] 
Improved seekable format ingestion speed for small frame size

As reported by @P-E-Meunier in https://github.com/facebook/zstd/issues/2662#issuecomment-1443836186,
seekable format ingestion speed can be particularly slow
when selected `FRAME_SIZE` is very small,
especially in combination with the recent row_hash compression mode.
The specific scenario mentioned was `pijul`,
using frame sizes of 256 bytes and level 10.

This is improved in this PR,
by providing approximate parameter adaptation to the compression process.

Tested locally on a M1 laptop,
ingestion of `enwik8` using `pijul` parameters
went from 35sec. (before this PR) to 2.5sec (with this PR).
For the specific corner case of a file full of zeroes,
this is even more pronounced, going from 45sec. to 0.5sec.

These benefits are unrelated to (and come on top of) other improvement efforts currently being made by @yoniko for the row_hash compression method specifically.

The `seekable_compress` test program has been updated to allows setting compression level,
in order to produce these performance results.

2 years agoMerge pull request #3542 from felixhandte/pin-moar-action-deps
Felix Handte [Fri, 10 Mar 2023 00:22:11 +0000 (16:22 -0800)] 
Merge pull request #3542 from felixhandte/pin-moar-action-deps

Pin Moar Action Dependencies

2 years agoAlso Pin Dockerfile Dependency Hashes 3542/head
W. Felix Handte [Thu, 9 Mar 2023 22:01:22 +0000 (17:01 -0500)] 
Also Pin Dockerfile Dependency Hashes

2 years agoMerge pull request #3541 from felixhandte/fix-setvbuf-segfault
Felix Handte [Thu, 9 Mar 2023 21:54:11 +0000 (13:54 -0800)] 
Merge pull request #3541 from felixhandte/fix-setvbuf-segfault

Avoid Segfault Caused by Calling `setvbuf()` on Null File Pointer

2 years agoMerge pull request #3526 from facebook/bench_zstd_api
Yann Collet [Thu, 9 Mar 2023 21:11:11 +0000 (13:11 -0800)] 
Merge pull request #3526 from facebook/bench_zstd_api

Simplify benchmark unit invocation API from CLI

2 years agoMerge pull request #3538 from facebook/doc_huffman
Yann Collet [Thu, 9 Mar 2023 21:09:42 +0000 (13:09 -0800)] 
Merge pull request #3538 from facebook/doc_huffman

added clarifications for sizes of compressed huffman blocks and streams.

2 years agoMerge pull request #3486 from daniellerozenblit/patch-from-low-memory-mode
daniellerozenblit [Thu, 9 Mar 2023 20:30:09 +0000 (15:30 -0500)] 
Merge pull request #3486 from daniellerozenblit/patch-from-low-memory-mode

Mmap large dictionaries in patch-from mode

2 years agoClarify dstCapacity requirements
Nick Terrell [Tue, 7 Mar 2023 23:42:51 +0000 (15:42 -0800)] 
Clarify dstCapacity requirements

Clarify `dstCapacity` requirements for single-pass functions.

Fixes #3524.

2 years agoPin Moar Action Dependencies
W. Felix Handte [Thu, 9 Mar 2023 17:54:07 +0000 (12:54 -0500)] 
Pin Moar Action Dependencies

An offering to the Scorecard gods, may they have mercy on our souls.

2 years agoAdd CLI Test 3541/head
W. Felix Handte [Thu, 9 Mar 2023 17:48:11 +0000 (12:48 -0500)] 
Add CLI Test

2 years agoAvoid Calling `setvbuf()` on Null File Pointer
W. Felix Handte [Thu, 9 Mar 2023 17:47:40 +0000 (12:47 -0500)] 
Avoid Calling `setvbuf()` on Null File Pointer

2 years agoFix Python 3.6 Incompatibility in CLI Tests
W. Felix Handte [Thu, 9 Mar 2023 17:46:37 +0000 (12:46 -0500)] 
Fix Python 3.6 Incompatibility in CLI Tests

2 years agoassert to ensure that dict buffer type is valid 3486/head
Danielle Rozenblit [Thu, 9 Mar 2023 00:54:57 +0000 (16:54 -0800)] 
assert to ensure that dict buffer type is valid

2 years agoadded clarifications for sizes of compressed huffman blocks and streams. 3538/head
Yann Collet [Wed, 8 Mar 2023 23:30:27 +0000 (15:30 -0800)] 
added clarifications for sizes of compressed huffman blocks and streams.

2 years agoAdd ZSTD_set{C,F,}Params() helper functions
Nick Terrell [Tue, 7 Mar 2023 23:15:40 +0000 (15:15 -0800)] 
Add ZSTD_set{C,F,}Params() helper functions

* Add ZSTD_setFParams() and ZSTD_setParams()
* Modify ZSTD_setCParams() to use ZSTD_setParameter() to avoid a second path setting parameters
* Add unit tests
* Update documentation to suggest using them to replace deprecated functions

Fixes #3396.

2 years agoability to disable mmap + struct to manage FIO dictionary
Danielle Rozenblit [Wed, 8 Mar 2023 16:06:10 +0000 (08:06 -0800)] 
ability to disable mmap + struct to manage FIO dictionary

2 years ago[linux-kernel] Fix assert definition
Nick Terrell [Tue, 7 Mar 2023 23:47:36 +0000 (15:47 -0800)] 
[linux-kernel] Fix assert definition

Backport upstream fix of the assert definition. This code is currently unused, and can be enabled for testing, which is why it wasn't caught.

https://lore.kernel.org/lkml/20230129131436.1343228-1-j.neuschaefer@gmx.net/

2 years agoAdds initialization of clevel to static cdict (#3525) (#3527)
Yonatan Komornik [Tue, 7 Mar 2023 02:05:12 +0000 (18:05 -0800)] 
Adds initialization of clevel to static cdict (#3525) (#3527)

- Initializes clevel in `ZSTD_CCtxParams_init`
- Adds CI workflow for msan fuzzers runs without optimization (`-O0`)
- Fixes Makefile to correctly pass on user defined `MOREFLAGS` and `FUZZER_FLAGS` in cases they have been overwritten

2 years agosimplified BMK_benchFilesAdvanced() 3526/head
Yann Collet [Mon, 6 Mar 2023 20:34:13 +0000 (12:34 -0800)] 
simplified BMK_benchFilesAdvanced()

2 years agominor: fixed zlib wrapper internal benchmark
Yann Collet [Mon, 6 Mar 2023 20:20:06 +0000 (12:20 -0800)] 
minor: fixed zlib wrapper internal benchmark

another possibility could be to link it to programs/benchfn .
Not worth the effort.

2 years agosimplify BMK_syntheticTest()
Yann Collet [Mon, 6 Mar 2023 20:15:22 +0000 (12:15 -0800)] 
simplify BMK_syntheticTest()

2 years agoMerge pull request #3516 from dloidolt/fullbench_2_files
Yann Collet [Mon, 6 Mar 2023 19:56:30 +0000 (11:56 -0800)] 
Merge pull request #3516 from dloidolt/fullbench_2_files

fullbench with two files

2 years agoBump github/codeql-action from 2.2.4 to 2.2.5 (#3518)
dependabot[bot] [Thu, 2 Mar 2023 18:44:06 +0000 (10:44 -0800)] 
Bump github/codeql-action from 2.2.4 to 2.2.5 (#3518)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.4 to 2.2.5.
- [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/17573ee1cc1b9d061760f3a006fc4aac4f944fd5...32dc499307d133bb5085bae78498c0ac2cf762d5)

---
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 agoMerge pull request #3513 from DimitriPapadopoulos/codespell
Yann Collet [Mon, 27 Feb 2023 19:44:31 +0000 (11:44 -0800)] 
Merge pull request #3513 from DimitriPapadopoulos/codespell

Fix typos found by codespell

2 years agoMerge pull request #3514 from facebook/spec_huffman
Yann Collet [Thu, 23 Feb 2023 23:35:00 +0000 (15:35 -0800)] 
Merge pull request #3514 from facebook/spec_huffman

Clarify zstd specification for Huffman blocks

2 years ago[bug-fix] Fix rare corruption bug affecting the block splitter
Nick Terrell [Wed, 22 Feb 2023 22:49:08 +0000 (14:49 -0800)] 
[bug-fix] Fix rare corruption bug affecting the block splitter

The block splitter confuses sequences with literal length == 65536 that use a
repeat offset code. It interprets this as literal length == 0 when deciding the
meaning of the repeat offset, and corrupts the repeat offset history. This is
benign, merely causing suboptimal compression performance, if the confused
history is flushed before the end of the block, e.g. if there are 3 consecutive
non-repeat code sequences after the mistake. It also is only triggered if the
block splitter decided to split the block.

All that to say: This is a rare bug, and requires quite a few conditions to
trigger. However, the good news is that if you have a way to validate that the
decompressed data is correct, e.g. you've enabled zstd's checksum or have a
checksum elsewhere, the original data is very likely recoverable. So if you were
affected by this bug please reach out.

The fix is to remind the block splitter that the literal length is actually 64K.
The test case is a bit tricky to set up, but I've managed to reproduce the issue.

Thanks to @danlark1 for alerting us to the issue and providing us a reproducer!

2 years agoWhen benchmarking two files with fullbench, the second file will not be benchmarked... 3516/head
Dominik Loidolt [Mon, 20 Feb 2023 15:36:26 +0000 (16:36 +0100)] 
When benchmarking two files with fullbench, the second file will not be benchmarked because the benchNb has not been reset to zero.

2 years agoclarify zstd specification for Huffman blocks 3514/head
Yann Collet [Sun, 19 Feb 2023 02:16:00 +0000 (18:16 -0800)] 
clarify zstd specification for Huffman blocks

Following detailed comments from @dweiller in #3508.

2 years agoFix typos found by codespell 3513/head
Dimitri Papadopoulos [Sat, 18 Feb 2023 09:30:23 +0000 (10:30 +0100)] 
Fix typos found by codespell

2 years agoMerge pull request #3490 from eli-schwartz/meson-tests-noprograms
Yann Collet [Thu, 16 Feb 2023 19:27:27 +0000 (11:27 -0800)] 
Merge pull request #3490 from eli-schwartz/meson-tests-noprograms

meson: always build the zstd binary when tests are enabled

2 years agoDon't require CMake 3.18 or later
Sutou Kouhei [Tue, 14 Feb 2023 21:38:50 +0000 (06:38 +0900)] 
Don't require CMake 3.18 or later

fix #3500

CMake 3.18 or later was required by #3392. Because it uses
`CheckLinkerFlag`. But requiring CMake 3.18 or later is a bit
aggressive. Because Ubuntu 20.04 LTS still uses CMake 3.16.3:
https://packages.ubuntu.com/search?keywords=cmake

This change disables `-z noexecstack` check with old CMake. This will
not break any existing users. Because users who need `-z noexecstack`
must already use CMake 3.18 or later.

2 years agoMerge pull request #3479 from felixhandte/faster-file-ops
Felix Handte [Thu, 16 Feb 2023 18:07:34 +0000 (13:07 -0500)] 
Merge pull request #3479 from felixhandte/faster-file-ops

Use `f`-variants of `chmod()` and `chown()`

2 years agoMerge pull request #3511 from felixhandte/fix-release-artifact-upload-permission
Felix Handte [Wed, 15 Feb 2023 18:35:04 +0000 (13:35 -0500)] 
Merge pull request #3511 from felixhandte/fix-release-artifact-upload-permission

Fix Permissions on Publish Release Artifacts Job

2 years agoMerge pull request #3509 from daniellerozenblit/fix-window-resize-test
daniellerozenblit [Wed, 15 Feb 2023 18:32:07 +0000 (13:32 -0500)] 
Merge pull request #3509 from daniellerozenblit/fix-window-resize-test

Fix cli-tests issues

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 agoadd make test for 32bit 3509/head
Danielle Rozenblit [Wed, 15 Feb 2023 14:03:02 +0000 (06:03 -0800)] 
add make test for 32bit

2 years agofix cli-tests issues
Danielle Rozenblit [Tue, 14 Feb 2023 19:33:26 +0000 (11:33 -0800)] 
fix cli-tests issues

2 years agoadd manual flag to mmap dictionary
Danielle Rozenblit [Tue, 14 Feb 2023 17:42:23 +0000 (09:42 -0800)] 
add manual flag to mmap dictionary

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 agorefactor dictionary file stat
Danielle Rozenblit [Mon, 13 Feb 2023 23:23:06 +0000 (15:23 -0800)] 
refactor dictionary file stat

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 agommap dicitonaries for large dictionaries in patch-from
Danielle Rozenblit [Mon, 13 Feb 2023 15:26:22 +0000 (07:26 -0800)] 
mmap dicitonaries for large dictionaries in patch-from

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 agomeson: always build the zstd binary when tests are enabled 3490/head
Eli Schwartz [Fri, 10 Feb 2023 04:55:09 +0000 (23:55 -0500)] 
meson: always build the zstd binary when tests are enabled

We need to run it for the tests, even if programs are disabled. So if
they are disabled, create a build rule for the program, but don't
install it. Just make it available for the test itself.

2 years agomeson: correctly specify the dependency relationship for playtests
Eli Schwartz [Fri, 10 Feb 2023 05:28:47 +0000 (00:28 -0500)] 
meson: correctly specify the dependency relationship for playtests

It depends on the zstd program being built, and passes it as an env
variable. Just like datagen. But for datagen, we explicitly depend on
it, while for zstd, we assume it's built as part of "all".

This can be wrong in two cases:
- when running individual tests, meson can (re)build just what is needed
  for that one test
- a later patch will handle building zstd but not by default

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 agoinitial commit
Danielle Rozenblit [Thu, 9 Feb 2023 15:47:21 +0000 (07:47 -0800)] 
initial commit

2 years agoinitial commit
Danielle Rozenblit [Thu, 9 Feb 2023 15:40:25 +0000 (07:40 -0800)] 
initial commit

2 years agoinitial commit
Danielle Rozenblit [Thu, 9 Feb 2023 15:37:37 +0000 (07:37 -0800)] 
initial commit

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 agoUse File Descriptor in Setting Stat on Output File 3479/head
W. Felix Handte [Mon, 6 Feb 2023 16:05:47 +0000 (08:05 -0800)] 
Use File Descriptor in Setting Stat on Output File

Note that the `fd` is only valid while the file is still open. So we need to
move the setting calls to before we close the file. However! We cannot do so
with the `utime()` call (even though `futimens()` exists) because the follow-
ing `close()` call to the `fd` will reset the atime of the file. So it seems
the `utime()` call has to happen after the file is closed.

2 years agoIntroduce Variants of Some Functions that Take Optional File Descriptors
W. Felix Handte [Fri, 3 Feb 2023 21:48:34 +0000 (13:48 -0800)] 
Introduce Variants of Some Functions that Take Optional File Descriptors

Somewhat surprisingly, calling `fchmod()` is non-trivially faster than calling
`chmod()`, and so on.

This commit introduces alternate variants to some common file util functions
that take an optional fd. If present, they call the `f`-variant of the
underlying function. Otherwise, they fall back to the regular filename-taking
version of the function.

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