Skip to content

Commit

Permalink
Disable recursion limit in serde_json
Browse files Browse the repository at this point in the history
This is needed to parse the llbc file emitted by charon on itself ^^'
  • Loading branch information
Nadrieril committed Jul 4, 2024
1 parent 13ba695 commit 221c021
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
11 changes: 11 additions & 0 deletions charon/Cargo.lock

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

3 changes: 2 additions & 1 deletion charon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ petgraph = "0.6.2"
pretty = "0.12"
regex = "1.7.1"
rustc_version = "0.4"
serde_json = "1.0.91"
serde_json = { version = "1.0.91", features = ["unbounded_depth"] }
serde_stacker = "0.1.11"
serde = { version = "1.0.152", features = ["derive"] }
stacker = "0.1"
take_mut = "0.2.2"
Expand Down
8 changes: 7 additions & 1 deletion charon/tests/generate-ml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,15 @@ fn generate_ml() -> Result<()> {
}

let crate_data: CrateData = {
use serde::Deserialize;
let file = File::open(charon_llbc)?;
let reader = BufReader::new(file);
serde_json::from_reader(reader)?
let mut deserializer = serde_json::Deserializer::from_reader(reader);
// Deserialize without recursion limit.
deserializer.disable_recursion_limit();
// Grow stack space as needed.
let deserializer = serde_stacker::Deserializer::new(&mut deserializer);
CrateData::deserialize(deserializer)?
};

let mut ctx = GenerateCtx {
Expand Down

0 comments on commit 221c021

Please sign in to comment.