Unverified Commit 5ef157dc authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Add fuzz testing harness to smithy-json and fix bug found by it (#462)

* Add fuzz harness for smithy-json with json_deserialize target

* Fix unescaping bug found by fuzzing

* CR feedback

* Run rustfmt
parent 2cef1e6b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line

target
corpus
artifacts
coverage
coverage.profdata
coverage.profraw
+31 −0
Original line number Diff line number Diff line
[package]
name = "smithy-json-fuzz"
version = "0.0.0"
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "John DiSanti <jdisanti@amazon.com>"]
publish = false
edition = "2018"

[package.metadata]
cargo-fuzz = true

[dependencies]
libfuzzer-sys = "0.4"
serde_json = { version = "1", features = ["float_roundtrip"] }
smithy-json = { path = ".." }
smithy-types = { path = "../../smithy-types" }

# Prevent this from interfering with workspaces
[workspace]
members = ["."]

[[bin]]
name = "json_deserialize"
path = "fuzz_targets/json_deserialize.rs"
test = false
doc = false

[[bin]]
name = "json_deserialize_corpus_cov"
path = "fuzz_targets/json_deserialize_corpus_cov.rs"
test = false
doc = false
+1 −0
Original line number Diff line number Diff line
[null, true, false, 0, -1, 2.2, -2.2, 2e5, "test", "\t", "\u0078", [], [1], {}, {"foo": 1}]
+1 −0
Original line number Diff line number Diff line
"\uD801\uDC37\/\b\n\r\\\t\"\f\u0000"
+7 −0
Original line number Diff line number Diff line
{ "some_int": 5,
  "some_float": 5.2,
  "some_negative": -5,
  "some_negative_float": -2.4,
  "some_string": "test",
  "some_struct": { "nested": "asdf" },
  "some_array": ["one", "two"] }
Loading