Skip to content

Commit

Permalink
Updates back to match the logic from jzlib's Deflate class to set len
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoodkft committed Oct 28, 2024
1 parent 3c1bd9a commit dc5e1b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/jcraft/jsch/jzlib/Deflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,9 @@ int longest_match(int cur_match) {
&& window[++scan] == window[++match] && window[++scan] == window[++match]
&& scan < strend);

len = MAX_MATCH - strend - scan;
// len here is set to MAX_MATCH minus (strend minus scan, i.e. the distance between scan and
// strend) to ensure that best_len is set to the best possible length to lookahead
len = MAX_MATCH - (strend - scan);
scan = strend - MAX_MATCH;

if (len > best_len) {
Expand Down

0 comments on commit dc5e1b9

Please sign in to comment.