Skip to content

[3.14] gh-160162: Fix crash in int left shift with huge count on 32-bit (GH-160163) - #160170

Merged
gpshead merged 1 commit into
python:3.14from
miss-islington:backport-d4750a7-3.14
Oct 22, 2026
Merged

gpshead merged 1 commit into
python:3.14from
miss-islington:backport-d4750a7-3.14

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Bound the shift count by MAX_LONG_DIGITSPyLong_SHIFT instead of
PY_SSIZE_T_MAX
PyLong_SHIFT, so that the result size computed in
long_lshift1() cannot overflow Py_ssize_t.
(cherry picked from commit d4750a7)

Co-authored-by: Gregory P. Smith 68491+gpshead@users.noreply.github.com

pythonGH-160163)

Bound the shift count by MAX_LONG_DIGITS*PyLong_SHIFT instead of
PY_SSIZE_T_MAX*PyLong_SHIFT, so that the result size computed in
long_lshift1() cannot overflow Py_ssize_t.
(cherry picked from commit d4750a7)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
@bedevere-app bedevere-app Bot added the sprint label Oct 22, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Oct 22, 2026
@gpshead
gpshead enabled auto-merge (squash) October 22, 2026 03:50
@gpshead gpshead self-assigned this Oct 22, 2026
@gpshead
gpshead merged commit 8c66e51 into python:3.14 Oct 22, 2026
53 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Oct 22, 2026
@miss-islington
miss-islington deleted the backport-d4750a7-3.14 branch October 22, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants