Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zstd: Fix corrupted output in "best" #876

Merged
merged 3 commits into from
Oct 22, 2023
Merged

Commits on Oct 22, 2023

  1. zstd: Fix corrupted output in "best"

    Regression from #784 and followup #793
    
    Fixes #875
    
    A 0 offset backreference was possible when "improve" was successful twice in a row in the "skipBeginning" part, only finding 2 (previously unmatches) length 4 matches, but where start offset decreased by 2 in both cases.
    
    This would result in output where the end offset would equal to the next 's', thereby doing a self-reference.
    
    Add a general check in "improve" and just reject these. Will also guard against similar issues in the future.
    
    This also hints at some potentially suboptimal hash indexing - but I will take that improvement separately.
    
    Fuzz test set updated.
    klauspost committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    874e125 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6c3bd8f View commit details
    Browse the repository at this point in the history
  3. Update error text.

    klauspost committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    cf676fe View commit details
    Browse the repository at this point in the history