From 40d789c9cdcd6ad03c2c9da2c81a4168a916872c Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Wed, 7 Oct 2026 13:58:01 +0100 Subject: [PATCH] Reject dashed byte string literals --- engine/src/rhs_types/bytes.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engine/src/rhs_types/bytes.rs b/engine/src/rhs_types/bytes.rs index a83b8f18..2aa429c4 100644 --- a/engine/src/rhs_types/bytes.rs +++ b/engine/src/rhs_types/bytes.rs @@ -177,7 +177,6 @@ fn write_char(vec: &mut Vec, c: char) { #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Serialize)] enum ByteSeparator { Colon, - Dash, } impl Lex<'_> for ByteSeparator { @@ -185,7 +184,6 @@ impl Lex<'_> for ByteSeparator { let (sep, rest) = take(input, 1)?; match sep { ":" => Ok((ByteSeparator::Colon, rest)), - "-" => Ok((ByteSeparator::Dash, rest)), _ => Err((LexErrorKind::ExpectedName("byte separator"), sep)), } } @@ -343,7 +341,7 @@ mod test { #[test] fn test() { assert_ok!( - BytesExpr::lex("01:2e:f3-77:12;"), + BytesExpr::lex("01:2e:f3:77:12;"), BytesExpr::from(vec![0x01, 0x2E, 0xF3, 0x77, 0x12]), ";" ); @@ -385,7 +383,7 @@ mod test { ); assert_ok!( - BytesExpr::lex("01:2f-34"), + BytesExpr::lex("01:2f:34"), BytesExpr::from(vec![0x01, 0x2F, 0x34]) );