Skip to content
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.

Deserialization of enum variants only accepts fixed length map #199

Open
valpackett opened this issue Jul 5, 2020 · 1 comment · May be fixed by #217
Open

Deserialization of enum variants only accepts fixed length map #199

valpackett opened this issue Jul 5, 2020 · 1 comment · May be fixed by #217

Comments

@valpackett
Copy link

cbor/src/de.rs

Line 859 in a218403

Some(0xa1) => {

If I try to write an enum as e.g. \xbf\x67variant\x65hello\xff there's a somewhat confusing error: "invalid type: map, expected variant identifier"

This is probably not common (I was just writing a test with manually written cbor bytes) but theoretically some implementation in another language could always rewrite maps into indeterminate length maps..

@jcfj
Copy link

jcfj commented Jun 28, 2021

I ran into this with CBOR generated from JSON in Java's Jackson.
[Edit:] It also happens with @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT), which is roughly equivalent to serde's external tagging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants