Skip to content

Commit 3ec5457

Browse files
committed
Verify hex string before attempting deserialization
1 parent 8158f8b commit 3ec5457

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/frontend/serialization.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ where
149149
D: serde::Deserializer<'de>,
150150
{
151151
let hex_str = String::deserialize(deserializer)?;
152+
153+
if !hex_str.chars().count() == 64 || !hex_str.chars().all(|c| c.is_ascii_hexdigit()) {
154+
return Err(serde::de::Error::custom(
155+
"Invalid hex string format - expected 64 hexadecimal characters",
156+
));
157+
}
158+
152159
let mut v = [F::ZERO; N];
153160
for i in 0..N {
154161
let start = i * 16;

0 commit comments

Comments
 (0)