From e27d1d5ecd30c8c15cf11b36c5cfbf402dbca0bb Mon Sep 17 00:00:00 2001 From: Juniper Tyree <50025784+juntyr@users.noreply.github.com> Date: Sat, 14 Oct 2023 23:04:45 +0200 Subject: [PATCH] Fix bug in fuzzer with deny_unknown_fields structs inside flatten (#517) --- fuzz/fuzz_targets/bench/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fuzz/fuzz_targets/bench/lib.rs b/fuzz/fuzz_targets/bench/lib.rs index 2f0c3aaf..7e1f89c1 100644 --- a/fuzz/fuzz_targets/bench/lib.rs +++ b/fuzz/fuzz_targets/bench/lib.rs @@ -1750,6 +1750,10 @@ impl<'a, 'de> DeserializeSeed<'de> for BorrowedTypedSerdeData<'a> { )); }; } + // flattened structs are incompatible with strict fields + while map.next_key::()?.is_some() { + map.next_value::().map(|_| ())?; + } Ok(()) } } @@ -2197,6 +2201,11 @@ impl<'a, 'de> DeserializeSeed<'de> for BorrowedTypedSerdeData<'a> { )); }; } + // flattened struct variants are incompatible with strict fields + while map.next_key::()?.is_some() { + map.next_value::() + .map(|_| ())?; + } Ok(()) } } @@ -3721,6 +3730,10 @@ impl<'a, 'de> DeserializeSeed<'de> for BorrowedTypedSerdeData<'a> { )); }; } + // flattened struct variants are incompatible with strict fields + while map.next_key::()?.is_some() { + map.next_value::().map(|_| ())?; + } Ok(()) } }