-
Notifications
You must be signed in to change notification settings - Fork 44
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
Combination of optional fields and explicit tag ignores the option type #272
Comments
Seems like that current option values are based on mapping the Result to Option, so Option value is not really based on the decoder logic: impl rasn::Decode for SequenceOptionals {
fn decode_with_tag_and_constraints<'constraints, D: rasn::Decoder>(
decoder: &mut D,
tag: rasn::Tag,
constraints: rasn::types::Constraints<'constraints>,
) -> core::result::Result<Self, D::Error> {
decoder.decode_sequence(tag, None::<fn() -> Self>, |decoder| {
Ok(Self {
it: {
decoder
.decode_explicit_prefix(rasn::Tag::new(rasn::types::Class::Context, 0))
.map_err(|error| {
rasn::de::Error::field_error(
"SequenceOptionals.it",
error.into(),
decoder.codec(),
)
})?
},
is: {
decoder
.decode_explicit_prefix(rasn::Tag::new(rasn::types::Class::Context, 1))
.ok()
},
late: {
decoder
.decode_explicit_prefix(rasn::Tag::new(rasn::types::Class::Context, 2))
.ok()
},
})
})
}
} |
Seems like there is also bug in OER. When resolved, it which fixes this particular case, but I am not sure if this is still issue on some other scenarios. |
We can probably remove the ok and/or add an explicit type parameter to decode explicit prefix. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When explicit tags are used for optional fields, wrong decoding (maybe encoding too) functions are derived. Or maybe option type disappears somehow, as the code does not hit the
decode_optional_*
methods.This seemed to be rather hard to debug, if there are any hints where this check happens.
Output (decoder does not hit the
decode_option_*
With
tag()
it works fine and correct code is executed.The text was updated successfully, but these errors were encountered: