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

Bugfix offset #3

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.4.4
## Bugs
* Fixed a panic caused by input sequences shorter than the offset compare length

# v0.4.3
## Bugs
* Fixed a panic caused by an unchecked `unwrap()` in a `trace!` statement
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "waffle_con"
version = "0.4.3"
version = "0.4.4"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
3 changes: 3 additions & 0 deletions src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ impl ConsensusNode {

// build up the search space
let con_len = self.consensus.len();

// we need to truncate the compare length if it is longer than the sequence
let offset_compare_length = offset_compare_length.min(sequence.len());

// figure out how far back we search
let start_delta = offset_window + offset_compare_length; // we search from current back to the offset_window
Expand Down
3 changes: 3 additions & 0 deletions src/dual_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,9 @@ impl DualConsensusNode {
vec![(&mut self.dwfas1, &self.consensus1)]
};

// we need to truncate the compare length if it is longer than the sequence
let offset_compare_length = offset_compare_length.min(sequence.len());

for (dwfas, consensus) in activators.into_iter() {
// make sure everything is currently inactive
assert!(dwfas[seq_index].is_none());
Expand Down
Loading