Skip to content

flexi decoder related fixes - #822

Open
karel-m wants to merge 1 commit into
developfrom
pr/fix-flexi
Open

karel-m wants to merge 1 commit into
developfrom
pr/fix-flexi

Conversation

@karel-m

@karel-m karel-m commented Nov 17, 2026

Copy link
Copy Markdown
Member

While analysing #817 I came across these issues/improvements.

After decoding a primitive element, the flexi decoder moved forward by the re-encoded length of the value instead of the length from the element header. When the two differ the decoder ended up at the wrong position:

  • a UTCTime without seconds re-encodes longer, so a UTCTime at the end of the input made the decoder read past the buffer
  • overlong UTF-8 re-encodes shorter, so the rest of the string was parsed as extra elements

Changes:

  • pass the element length from the header to each primitive decoder
  • return CRYPT_INVALID_PACKET if the re-encoded length differs from the header length, i.e. the element is not DER

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 this pull request may close these issues.

2 participants