Skip to content

Commit

Permalink
feat: up hex limit (#63)
Browse files Browse the repository at this point in the history
Ups the maximum allowed hex string to 256kb
  • Loading branch information
SWvheerden committed Sep 27, 2023
1 parent 078633b commit 4c1381a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use snafu::prelude::*;
use crate::alloc::string::ToString;

/// Maximum bytes allowed for parsing to hex.
const MAX_BYTES_SIZE: usize = 4096;
const MAX_BYTES_SIZE: usize = 262_144; // 256kb

/// Any object implementing this trait has the ability to represent itself as a hexadecimal string and convert from it.

Expand Down Expand Up @@ -161,14 +161,14 @@ mod test {

#[test]
fn max_length_error() {
let bytes = [0; 4096];
let bytes = [0; 262_144];
let mut hex = "".to_string();
for _ in 0..4096 {
for _ in 0..262_144 {
hex.push_str("00");
}
assert_eq!(hex, bytes.to_hex());

let bytes = [0; 4097];
let bytes = [0; 262_145];
assert_eq!("**String to large**", bytes.to_hex());
}

Expand Down

0 comments on commit 4c1381a

Please sign in to comment.