Skip to content

Commit

Permalink
Remove dependency on lexical crates.
Browse files Browse the repository at this point in the history
The family of lexical crates have a variety of unresolved safety issues and no activity in the last two years. Considering we're only using it in two places, it makes morse sense to just use the built in conversion for usize and reduce the number of dependencies.

Signed-off-by: David Skidmore <davidskidmore@google.com>
  • Loading branch information
davidskidmore authored and jyao1 committed Jun 24, 2024
1 parent 31cbac7 commit b3404f9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 75 deletions.
71 changes: 0 additions & 71 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/policy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ edition = "2018"
[dependencies]
cc-measurement = { path = "../../deps/td-shim/cc-measurement"}
crypto = { path = "../crypto" }
lexical-core = { version = "0.8.3", default-features = false, features = ["write-integers", "write-floats", "parse-integers", "parse-floats"] }
log = { version = "0.4.13", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"]}
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
Expand Down
5 changes: 2 additions & 3 deletions src/policy/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use alloc::{collections::BTreeMap, fmt::Write, string::String, vec::Vec};
use core::{mem::size_of, ops, str::FromStr};
use lexical_core::parse;
use serde::{
de::{Error, Visitor},
Deserialize, Deserializer,
Expand Down Expand Up @@ -315,13 +314,13 @@ fn parse_range(input: &str) -> Option<ops::Range<usize>> {
let start = if parts[0].is_empty() {
usize::MIN
} else {
parse::<usize>(parts[0].as_bytes()).ok()?
usize::from_str(parts[0]).ok()?
};

let end: usize = if parts[1].is_empty() {
usize::MAX
} else {
parse::<usize>(parts[1].as_bytes()).ok()?
usize::from_str(parts[1]).ok()?
};

Some(start..end)
Expand Down

0 comments on commit b3404f9

Please sign in to comment.