diff --git a/Cargo.toml b/Cargo.toml index da7bf79..4b8fa05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" readme = "README.md" description = "find multi-byte-encoded strings in binary data" license = "MIT/Apache-2.0" -categories = ["command-line-utilities", "encoding", "text-processing", +categories = ["command-line-utilities", "encoding", "text-processing", "filesystem"] documentation = "https://blog.getreu.net/projects/stringsext/stringsext--manpage.html" homepage = "https://blog.getreu.net/projects/stringsext/" @@ -24,8 +24,9 @@ scoped_threadpool = "0.1.9" anyhow = "1.0.27" clap = "2.33.0" structopt = "0.3.12" +pin-project = "0.4.23" -# Metadata for debian packages with cargo-deb +# Metadata for Debian packages with cargo-deb [package.metadata.deb] maintainer = "Jens Getreu, " diff --git a/src/finding.rs b/src/finding.rs index 8323c68..db121af 100644 --- a/src/finding.rs +++ b/src/finding.rs @@ -8,6 +8,7 @@ use crate::mission::Mission; use crate::options::Radix; use crate::options::ARGS; use crate::options::ASCII_ENC_LABEL; +use pin_project::pin_project; use std::io::Write; use std::ops::Deref; use std::str; @@ -31,6 +32,9 @@ pub const OUTPUT_BUF_LEN: usize = 0x40; pub const OUTPUT_LINE_METADATA_LEN: usize = 40; /// `FindingCollection` is a set of ordered `Finding` s. +/// This struct is self referential, because `Finding` points into +/// `output_buffer_bytes`, hence pinning is required here. +#[pin_project] #[derive(Debug)] pub struct FindingCollection<'a> { /// `Finding` s in this vector are in chronological order. @@ -44,6 +48,7 @@ pub struct FindingCollection<'a> { /// some `Finding`-objects stored in a `FindingCollection`. The /// `Finding`-objects have a `&str`-member called `Finding::s` that is /// a substring of `output_buffer_bytes`. + #[pin] pub output_buffer_bytes: Box<[u8]>, /// If `output_buffer` is too small to receive all findings, this is set /// `true` indicating that only the last `Finding` s could be stored. At