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
@read-the-docs-community

Copy link
Copy Markdown

@encukou encukou marked this pull request as draft July 8, 2026 08:07

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@encukou: Why did you mark the PR as a draft? IMO we should apply this fix to Python 3.11 (the macOS CI is failing).

@encukou

encukou commented Jul 12, 2026

Copy link
Copy Markdown
Member

LGTM.

@encukou: Why did you mark the PR as a draft? IMO we should apply this fix to Python 3.11 (the macOS CI is failing).

See here: #100373 (comment)

It's not a security issue; if the RM doesn't want this fix we can also skip the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants