summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-04-14 01:38:37 (GMT)
committerGitHub <noreply@github.com>2022-04-14 01:38:37 (GMT)
commit72114c06fd8f105437d671277b0593a378ecc3f4 (patch)
tree6801f9f3caaa364f709e159b28282af22f6aedd6 /Misc
parent89697f7374ea947ebe8e36131e2d3e21fff6fa1d (diff)
downloadcpython-72114c06fd8f105437d671277b0593a378ecc3f4.zip
cpython-72114c06fd8f105437d671277b0593a378ecc3f4.tar.gz
cpython-72114c06fd8f105437d671277b0593a378ecc3f4.tar.bz2
gh-91421: Use constant value check during runtime (GH-91422) (GH-91492)
The left-hand side expression of the if-check can be converted to a constant by the compiler, but the addition on the right-hand side is performed during runtime. Move the addition from the right-hand side to the left-hand side by turning it into a subtraction there. Since the values are known to be large enough to not turn negative, this is a safe operation. Prevents a very unlikely integer overflow on 32 bit systems. Fixes GH-91421. (cherry picked from commit 0859368335d470b9ff33fc53ed9a85ec2654b278) Co-authored-by: Tobias Stoeckmann <stoeckmann@users.noreply.github.com>
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-04-10-22-57-27.gh-issue-91421.dHhv6U.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-04-10-22-57-27.gh-issue-91421.dHhv6U.rst b/Misc/NEWS.d/next/Core and Builtins/2022-04-10-22-57-27.gh-issue-91421.dHhv6U.rst
new file mode 100644
index 0000000..898eb0d
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-04-10-22-57-27.gh-issue-91421.dHhv6U.rst
@@ -0,0 +1 @@
+Fix a potential integer overflow in _Py_DecodeUTF8Ex.