Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Fix of erroneously accepted input when deserializing scalars #9

Merged
merged 2 commits into from
May 14, 2022

Conversation

Mingun
Copy link
Owner

@Mingun Mingun commented May 9, 2022

This PR fixes the following situation, when

#[derive(Deserialize)]
struct AnyName {
  field: usize, // or any other number / string / boolean
}

is successfully deserialized from

<any-tag>
  <field><any-tag>42</any-tag></field>
<any-tag>

when it shouldn't.

Mingun and others added 2 commits May 9, 2022 12:58
We should ensure, that incorrect input do not deserializing into object.
That could influence untagged enums because thy rely on deserialization
failures when selects right variant

failures (38):
    trivial::struct_::cdata::byte_buf
    trivial::struct_::cdata::char_
    trivial::struct_::cdata::f32_
    trivial::struct_::cdata::f64_
    trivial::struct_::cdata::false_
    trivial::struct_::cdata::i128_
    trivial::struct_::cdata::i16_
    trivial::struct_::cdata::i32_
    trivial::struct_::cdata::i64_
    trivial::struct_::cdata::i8_
    trivial::struct_::cdata::isize_
    trivial::struct_::cdata::string
    trivial::struct_::cdata::true_
    trivial::struct_::cdata::u128_
    trivial::struct_::cdata::u16_
    trivial::struct_::cdata::u32_
    trivial::struct_::cdata::u64_
    trivial::struct_::cdata::u8_
    trivial::struct_::cdata::usize_
    trivial::struct_::text::byte_buf
    trivial::struct_::text::char_
    trivial::struct_::text::f32_
    trivial::struct_::text::f64_
    trivial::struct_::text::false_
    trivial::struct_::text::i128_
    trivial::struct_::text::i16_
    trivial::struct_::text::i32_
    trivial::struct_::text::i64_
    trivial::struct_::text::i8_
    trivial::struct_::text::isize_
    trivial::struct_::text::string
    trivial::struct_::text::true_
    trivial::struct_::text::u128_
    trivial::struct_::text::u16_
    trivial::struct_::text::u32_
    trivial::struct_::text::u64_
    trivial::struct_::text::u8_
    trivial::struct_::text::usize_
@Mingun Mingun added bug Something isn't working serde labels May 9, 2022
@Mingun Mingun merged commit 11d9be4 into master May 14, 2022
@Mingun Mingun deleted the negative-trivial branch May 14, 2022 10:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working serde
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant