Skip to content

Commit

Permalink
Merge pull request #41 from aschampion/issues/39
Browse files Browse the repository at this point in the history
Fix roundtrip bug
  • Loading branch information
oyvindln authored Jan 23, 2020
2 parents 154bece + 3d90924 commit 999771d
Show file tree
Hide file tree
Showing 45 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lz77.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ fn process_chunk_lazy(
state.add = false;

// ADD
write_literal!(writer, state.prev_byte, position + 1);
write_literal!(writer, state.prev_byte, position);
};

// We are at the last two bytes we want to add, so there is no point
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,23 @@ fn issue_26_gzip() {
fn issue_18_201911() {
let test_file = "tests/issue_18_201911.bin";
let test_data = get_test_file_data(test_file);
// This was the failing compression mode.
roundtrip_conf(&test_data, deflate::Compression::Fast.into());
roundtrip_conf(&test_data, CompressionOptions::default());
}

#[test]
fn afl_regressions_default_compression() {
for entry in std::fs::read_dir("tests/afl/default").unwrap() {
let entry = entry.unwrap();
let test_file = entry.path();
if test_file.is_file() {
let test_filename = test_file.to_str().unwrap();
println!("{}", test_filename);
let test_data = get_test_file_data(test_filename);
// This was the failing compression mode.
roundtrip_conf(&test_data, CompressionOptions::default());
roundtrip_conf(&test_data, deflate::Compression::Fast.into());
}
}
}

0 comments on commit 999771d

Please sign in to comment.