Skip to content

Commit

Permalink
chore: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Feb 19, 2024
1 parent 0dbc8a7 commit 40d982f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions lib/src/compiler/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ use bstr::{BString, ByteVec};
///
/// `LUxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0`
///
/// The good news is that there are only 3 string that we need to look for:
/// `aXBzdW`, `lwc3Vt` or `pcHN1b`. If some string `S` contains "ipsum", the
/// The good news is that there are only 3 strings that we need to look for:
/// `aXBzdW`, `lwc3Vt` and `pcHN1b`. If some string `S` contains "ipsum", the
/// result of `base64(S)` must contain one of these three patterns.
///
/// These three patterns are the results of `base64(S)`, `base64("X" + S)`
/// These three patterns are the result of `base64(S)`, `base64("X" + S)`
/// and `base64("XX" + S)`, after removing the characters that are affected
/// by the "X" at the beginning of the pattern, or that could be affected
/// if more bytes bytes are added after "ipsum".
/// if more bytes are added after "ipsum".
///
/// padding + S base64(padding + S) final pattern
/// "ipsum" -> "aXBzdW0" -> "aXBzdW"
Expand Down
2 changes: 1 addition & 1 deletion lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mod wasm;
mod tests;

mod utils {
/// Tries to match `target` as an the enum variant `pat`. Returns the
/// Tries to match `target` as the enum variant `pat`. Returns the
/// inner value contained in the variant, or panics if `target` does
/// not match `pat`.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) struct Module {
/// module (e.g: "test_proto2").
pub rust_module_name: Option<&'static str>,
/// A [`MessageDescriptor`] that describes the module's structure. This
/// corresponds to the the protobuf message declared in the "root_message"
/// corresponds to the protobuf message declared in the "root_message"
/// for the YARA module. It allows iterating the fields declared by the
/// module and obtaining their names and types.
pub root_struct_descriptor: MessageDescriptor,
Expand Down
17 changes: 8 additions & 9 deletions lib/src/re/fast/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ impl Compiler {
}

// If the pattern was decomposed into more than one piece its atoms can
// not be exact. The atoms could be exact if the pattern was is a single
// piece and it fits completely in the atom.
// not be exact. The atoms could be exact if the pattern was a single
// piece, and it fits completely in the atom.
if pieces.len() > 1 {
for atom in atoms.iter_mut() {
atom.set_exact(false);
Expand Down Expand Up @@ -274,16 +274,15 @@ struct PatternSplitter {

impl PatternSplitter {
fn finish_literal(&mut self) -> Option<Pattern> {
// If the `bytes` is empty return `None` because empty literals
// are ignored, except when when we are inside an alternation,
// where empty literals are accepted in cases like `(abc|)`.
// If the `bytes` is empty return `None` because empty literals are
// ignored, except when we are inside an alternation, where empty
// literals are accepted in cases like `(abc|)`.
if !self.in_alternation && self.bytes.is_empty() {
return None;
}
// If all bytes in the mask are 0xff the piece is a
// Literal and the mask is not necessary, if not,
// the piece is a MaskedLiteral. In both cases the mask
// and the bytes are reset to empty vectors.
// If all bytes in the mask are 0xff the piece is a Literal and the
// mask is not necessary, if not, the piece is a MaskedLiteral. In both
// cases the mask and the bytes are reset to empty vectors.
if self.mask.iter().all(|&b| b == 0xff) {
self.mask.clear();
Some(Pattern::Literal(mem::take(&mut self.bytes)))
Expand Down
2 changes: 1 addition & 1 deletion lib/src/re/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The parsing of regular expressions is actually done by the [`regex-syntax`][1]
crate, which produces a high-level intermediate representation (HIR) for a
given regular expression in text form. This crates provides its own [`hir::Hir`]
type, but is is just a thin wrapper around the [`regex_syntax::hir::Hir`] type.
type, but is just a thin wrapper around the [`regex_syntax::hir::Hir`] type.
Both regexp patterns and hex patterns are converted into a [`hir::Hir`], as
every YARA hex pattern can be boiled down to a regular expression. Both kinds
Expand Down

0 comments on commit 40d982f

Please sign in to comment.