ron-rs / ron

Rusty Object Notation
https://docs.rs/ron
Apache License 2.0
3.31k stars 122 forks source link

Add recursive data cost to fuzzer + speed up `deserialize_any` identifier check #506

Closed juntyr closed 1 year ago

juntyr commented 1 year ago

Adding layers, e.g. enum variants or tuples, is not without cost in the format, so let's enforce that in the fuzzer as well.

Checking for an identifier in deserialize_any previously used the identifier parser, which has complex error handling to produce nice error messages. Since we only need to check if one is there, we now use skip_identifier, which now returns Option<&str> instead of bool, and thus avoids any allocation in the check.

* [ ] I've included my change in CHANGELOG.md

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (817407c) 100.00% compared to head (10f1e97) 100.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #506 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 78 78 Lines 11053 11063 +10 ========================================= + Hits 11053 11063 +10 ``` | [Files Changed](https://app.codecov.io/gh/ron-rs/ron/pull/506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [src/de/mod.rs](https://app.codecov.io/gh/ron-rs/ron/pull/506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2RlL21vZC5ycw==) | `100.00% <100.00%> (ø)` | | | [src/parse.rs](https://app.codecov.io/gh/ron-rs/ron/pull/506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3BhcnNlLnJz) | `100.00% <100.00%> (ø)` | | | [tests/438\_rusty\_byte\_strings.rs](https://app.codecov.io/gh/ron-rs/ron/pull/506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvNDM4X3J1c3R5X2J5dGVfc3RyaW5ncy5ycw==) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.