From e605cc25877c3b38b4a314b897b0d98dd7c1b5d6 Mon Sep 17 00:00:00 2001 From: unknowntrojan <14975032+unknowntrojan@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:28:03 +0200 Subject: fix crash related to segment edge case --- Cargo.toml | 18 +++++++++--------- src/lib.rs | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4172421..4a0d791 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "binja_coolsigmaker" -version = "0.1.2" +name = "binja_coolsigmaker" +version = "0.1.3" authors = ["unknowntrojan"] edition = "2021" @@ -8,7 +8,7 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -log = "0.4.17" +log = "0.4.17" clipboard = "0.5.0" # Local # binaryninja = { path = "../binaryninja-api/rust" } @@ -16,10 +16,10 @@ clipboard = "0.5.0" binaryninja = { git = "https://github.com/Vector35/binaryninja-api.git", branch = "dev" } # Stable # binaryninja = { git = "https://github.com/Vector35/binaryninja-api.git", tag = "v3.4.4271-stable" } -rayon = "1.7.0" -iced-x86 = "1.17.0" -strum = { version = "0.25.0", features = ["derive"] } -serde = { version = "1.0.152", features = ["std"] } -serde_json = "1.0.93" -thiserror = "1.0.43" +rayon = "1.7.0" +iced-x86 = "1.17.0" +strum = { version = "0.25.0", features = ["derive"] } +serde = { version = "1.0.152", features = ["std"] } +serde_json = "1.0.93" +thiserror = "1.0.43" coolfindpattern = "0.1.3" diff --git a/src/lib.rs b/src/lib.rs index 8fbfcbe..5e3252d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -519,7 +519,7 @@ fn create_pattern_internal( Err(SignatureError::OutOfBounds)? } - current_buffer.copy_from_slice( + current_buffer[..instr_len as _].copy_from_slice( &data .iter() .find(|segment| segment.0 == start_segment.address_range().start).ok_or(SignatureError::InvalidSegment)? @@ -823,7 +823,7 @@ pub extern "C" fn CorePluginInit() -> bool { ); // #[cfg(debug_assertions)] - let _ = std::fs::write("C:\\log.txt", &string); + let _ = std::fs::write("E:\\log.txt", &string); log::info!("{}", &string); })); -- cgit v1.3.1