-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to deserialize_str strings which are larger than 4096. #32
Comments
Same problem for me. It seems like |
acfoltzer
added a commit
to acfoltzer/ciborium
that referenced
this issue
Aug 30, 2022
Issue enarx#32 describes a class of errors where `deserialize_str` (and `deserialize_bytes`) have match expressions that fall through to an error when the `Text` (`Bytes`) lengths are longer than can fit in the scratch array. This patch works around that limitation by delegating to the corresponding allocating methods `deserialize_string` (`deserialize_byte_buf`) in case the scratch space is too small. This should address the issue even for types whose `Deserialize` visitor does not implement `visit_string`, since the default implementation of that method delegates back to `visit_str` once the fully-deserialized `String` is in hand. This addition raises a question to me about the stance of the `ciborium` crate on `no_std`/`alloc` support. This workaround depends on being able to use `String` and `Vec`, which rules out `no_std`. But these allocating deserializers already exist in the code and don't appear to be guarded by `cfg` directives, so I don't believe this patch changes the level of support provided for these environments.
acfoltzer
added a commit
to acfoltzer/ciborium
that referenced
this issue
Aug 30, 2022
Issue enarx#32 describes a class of errors where `deserialize_str` (and `deserialize_bytes`) have match expressions that fall through to an error when the `Text` (`Bytes`) lengths are longer than can fit in the scratch array. This patch works around that limitation by delegating to the corresponding allocating methods `deserialize_string` (`deserialize_byte_buf`) in case the scratch space is too small. This should address the issue even for types whose `Deserialize` visitor does not implement `visit_string`, since the default implementation of that method delegates back to `visit_str` once the fully-deserialized `String` is in hand. This addition raises a question to me about the stance of the `ciborium` crate on `no_std`/`alloc` support. This workaround depends on being able to use `String` and `Vec`, which rules out `no_std`. But these allocating deserializers already exist in the code and don't appear to be guarded by `cfg` directives, so I don't believe this patch changes the level of support provided for these environments.
acfoltzer
added a commit
to acfoltzer/ciborium
that referenced
this issue
Aug 30, 2022
Issue enarx#32 describes a class of errors where `deserialize_str` (and `deserialize_bytes`) have match expressions that fall through to an error when the `Text` (`Bytes`) lengths are longer than can fit in the scratch array. This patch works around that limitation by delegating to the corresponding allocating methods `deserialize_string` (`deserialize_byte_buf`) in case the scratch space is too small. This should address the issue even for types whose `Deserialize` visitor does not implement `visit_string`, since the default implementation of that method delegates back to `visit_str` once the fully-deserialized `String` is in hand. This addition raises a question to me about the stance of the `ciborium` crate on `no_std`/`alloc` support. This workaround depends on being able to use `String` and `Vec`, which rules out `no_std`. But these allocating deserializers already exist in the code and don't appear to be guarded by `cfg` directives, so I don't believe this patch changes the level of support provided for these environments.
acfoltzer
added a commit
to acfoltzer/ciborium
that referenced
this issue
Oct 6, 2022
Issue enarx#32 describes a class of errors where `deserialize_str` (and `deserialize_bytes`) have match expressions that fall through to an error when the `Text` (`Bytes`) lengths are longer than can fit in the scratch array. This patch works around that limitation by delegating to the corresponding allocating methods `deserialize_string` (`deserialize_byte_buf`) in case the scratch space is too small. This should address the issue even for types whose `Deserialize` visitor does not implement `visit_string`, since the default implementation of that method delegates back to `visit_str` once the fully-deserialized `String` is in hand. This addition raises a question to me about the stance of the `ciborium` crate on `no_std`/`alloc` support. This workaround depends on being able to use `String` and `Vec`, which rules out `no_std`. But these allocating deserializers already exist in the code and don't appear to be guarded by `cfg` directives, so I don't believe this patch changes the level of support provided for these environments.
acfoltzer
added a commit
to acfoltzer/ciborium
that referenced
this issue
Oct 12, 2022
Issue enarx#32 describes a class of errors where `deserialize_str` (and `deserialize_bytes`) have match expressions that fall through to an error when the `Text` (`Bytes`) lengths are longer than can fit in the scratch array. This patch works around that limitation by delegating to the corresponding allocating methods `deserialize_string` (`deserialize_byte_buf`) in case the scratch space is too small. This should address the issue even for types whose `Deserialize` visitor does not implement `visit_string`, since the default implementation of that method delegates back to `visit_str` once the fully-deserialized `String` is in hand. This addition raises a question to me about the stance of the `ciborium` crate on `no_std`/`alloc` support. This workaround depends on being able to use `String` and `Vec`, which rules out `no_std`. But these allocating deserializers already exist in the code and don't appear to be guarded by `cfg` directives, so I don't believe this patch changes the level of support provided for these environments. Adds regression tests for slightly-too-long string and byte sequence roundtripping.
Fixed in 0.2.1 and should be closed? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are trying to use ciborium to ser/de some complicated data. Part of the data invokes the
Deserializer::deserialize_str
and fails with an error:invalid type: string, expected str
. This is because that ciborium limit thedeserialze_str
size to a hard coded 4096.See:
ciborium/ciborium/src/de/mod.rs
Line 753 in 10b531e
ciborium/ciborium/src/de/mod.rs
Line 327 in 10b531e
Would it better to export a configurable limitation or alloc the internal buffer adaptively?
The text was updated successfully, but these errors were encountered: