Skip to content

[3.11] gh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)#153311

Draft
miss-islington wants to merge 1 commit into
python:3.11from
miss-islington:backport-acfe02f-3.11
Draft

[3.11] gh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)#153311
miss-islington wants to merge 1 commit into
python:3.11from
miss-islington:backport-acfe02f-3.11

Conversation

@miss-islington

@miss-islington miss-islington commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

In PEM, we need to parse until error and then suppress PEM_R_NO_START_LINE, because PEM allows arbitrary leading and trailing data. DER, however, does not. Parsing until error and suppressing ASN1_R_HEADER_TOO_LONG doesn't quite work because that error also covers some cases that should be rejected.

Instead, check BIO_eof early and stop the loop that way.
(cherry picked from commit acfe02f)

Co-authored-by: David Benjamin davidben@google.com
Automerge-Triggered-By: GH:Yhg1s

…honGH-100373)

In PEM, we need to parse until error and then suppress `PEM_R_NO_START_LINE`, because PEM allows arbitrary leading and trailing data. DER, however, does not. Parsing until error and suppressing `ASN1_R_HEADER_TOO_LONG` doesn't quite work because that error also covers some cases that should be rejected.

Instead, check `BIO_eof` early and stop the loop that way.
(cherry picked from commit acfe02f)

Co-authored-by: David Benjamin <davidben@google.com>
Automerge-Triggered-By: GH:Yhg1s
@encukou encukou marked this pull request as draft July 8, 2026 08:07
@gamercoool697-arch

Copy link
Copy Markdown

ok

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.

3 participants