Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@ericstj
Copy link
Member

@ericstj ericstj commented Apr 11, 2019

This fixes an issue where a repeat sequence longer than 258 would be
encoded using longer distance values after the first match.
When we load new data into the window, we invalidate the next match, in
case the match would improve. In this case, the hash has already been
updated with this data, so when we look for a new match it will point
it back at itself. As a result, a literal is generated even when a
better match is available.

This avoids that by catching this case and ensuring we're looking at the
past.
@stephentoub stephentoub merged commit 6322a40 into dotnet:master Apr 12, 2019
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* inflate: handle windowBits == 16

* deflate_medium: add dist -1 to hash even for long matches

This fixes an issue where a repeat sequence longer than 258 would be
encoded using longer distance values after the first match.

* deflate_medium: avoid emitting a suboptimal literal in the restart case

When we load new data into the window, we invalidate the next match, in
case the match would improve. In this case, the hash has already been
updated with this data, so when we look for a new match it will point
it back at itself. As a result, a literal is generated even when a
better match is available.

This avoids that by catching this case and ensuring we're looking at the
past.


Commit migrated from dotnet/corefx@6322a40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GZipStream regression - Much worse compression for sparse data when specifying CompressionLevel.Optimal

3 participants