fix(tags): raise SystemError for malformed cpython EXT_SUFFIX in _generic_abi#1301
Open
r266-tech wants to merge 1 commit into
Open
fix(tags): raise SystemError for malformed cpython EXT_SUFFIX in _generic_abi#1301r266-tech wants to merge 1 commit into
r266-tech wants to merge 1 commit into
Conversation
…eric_abi
A cpython-prefixed soabi with no version component (e.g. EXT_SUFFIX
".cpython.so") passes the top-of-function guard and the len(parts) < 3
check, but then hits soabi.split("-")[1] and raises an opaque IndexError
that escapes the public generic_tags()/sys_tags() API. Every other
interpreter branch uses split("-")[0] or a slice and never indexes past
the end, so only the cpython branch leaks.
This is the same wrong-exception-leak class fixed in pypa#1271 (empty
EXT_SUFFIX), just one branch deeper in the same function. Guard the
cpython soabi split and raise the documented SystemError instead, and
add a regression test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1271.
_generic_abi()still leaks an opaqueIndexError(instead of the documentedSystemError) from the publicgeneric_tags()/sys_tags()API for a malformed cpythonEXT_SUFFIX.#1271 fixed the top-of-function guard for an empty
EXT_SUFFIX, but the cpython branch a few lines down doessoabi.split("-")[1]:EXT_SUFFIX = ".cpython.so"→soabi = "cpython"→split("-") == ["cpython"]→[1]raisesIndexError: list index out of range.EXT_SUFFIX = ".cpython-.so"→soabi = "cpython-"→ empty version component → silently builds an invalid"cp"ABI.Every other interpreter branch uses
split("-")[0]or a slice and never over-indexes, so only the cpython branch is affected. This guards the split and raises the sameSystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")for both cases — the same wrong-exception-leak class fixed in #1271 / #1264 — plus a parametrized regression test.