Skip to content
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: add IsConstructed trait #1741

Open
dishmaker opened this issue Mar 25, 2025 · 0 comments · May be fixed by #1744
Open

der: add IsConstructed trait #1741

dishmaker opened this issue Mar 25, 2025 · 0 comments · May be fixed by #1744

Comments

@dishmaker
Copy link
Contributor

IMPLICIT decoder requires Tagged trait.

pub fn decode_implicit<'a, R: Reader<'a>>(
reader: &mut R,
tag_number: TagNumber,
) -> Result<Option<Self>, T::Error>
where
T: DecodeValue<'a> + Tagged,

IMPLICIT and EXPLICIT decoders check for constructed bit.
But IMPLICIT depends on value.tag() in runtime:

if header.tag.is_constructed() != value.tag().is_constructed() {
return Err(header.tag.non_canonical_error().into());

fn tag(&self) -> Tag {
let constructed = match self.tag_mode {
TagMode::Explicit => true,
TagMode::Implicit => self.value.tag().is_constructed(),

I think it should check constructed bit statically, like FixedTag.

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

Successfully merging a pull request may close this issue.

1 participant