-
Notifications
You must be signed in to change notification settings - Fork 141
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
DER: Over-eager consumption in AnyRef
#815
Comments
Looking at the impl<'a> Decode<'a> for AnyRef<'a> {
fn decode<R: Reader<'a>>(reader: &mut R) -> Result<AnyRef<'a>> {
let header = Header::decode(reader)?;
Ok(Self {
tag: header.tag,
value: ByteSlice::decode_value(reader, header)?,
})
}
}
Given that, I don't think this is a bug in the |
(This also makes sense given the |
@woodruffw yeah, that’s expected. If you want to store the original DER, use |
Closing in that case, since this was entirely a misunderstanding of the APIs on my part! |
This is a discrete issue for the behavior I'm seeing while testing #813, specifically in #813 (comment).
There, we have a struct that's annotated like so:
My expectation is that this definition would consume a DER structure like this:
...leaving
e_content_type
as1.2.3.4
ande_content
as:Experimentally, however, the borrowed slice in
e_content
'sAnyRef
contains:...meaning that the surrounding
SEQUENCE
was consumed. When I remove the#[asn1(...)]
annotation frome_content
, the behavior changes to what I expect:This suggests a bug to me, somewhere in the interaction between the
#[asn1(...)]
annotation andAnyRef
.I'll work on a minimal reproduction now, but this behavior is currently visible with the PKCS7 blob I shared on the other PR (https://github.com/RustCrypto/formats/files/10270816/authroot.stl.zip) and the changes in that PR.
The text was updated successfully, but these errors were encountered: