summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBrandt Bucher <brandt@python.org>2021-12-16 11:08:20 (GMT)
committerGitHub <noreply@github.com>2021-12-16 11:08:20 (GMT)
commit62a8a0c5223f750e22ee381d3cfbdb718cf1cc93 (patch)
treefb2cca71b0482717cf220f02b43a369977bff9fb /Python
parentc5d18a5014f649368b5a4bca94e9ec7d2908b481 (diff)
downloadcpython-62a8a0c5223f750e22ee381d3cfbdb718cf1cc93.zip
cpython-62a8a0c5223f750e22ee381d3cfbdb718cf1cc93.tar.gz
cpython-62a8a0c5223f750e22ee381d3cfbdb718cf1cc93.tar.bz2
bpo-45829: Check `__getitem__`'s version for overflow before specializing (GH-30129)
* Check __getitem__'s version for overflow. * Use SPEC_FAIL_OUT_OF_VERSIONS instead
Diffstat (limited to 'Python')
-rw-r--r--Python/specialize.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 7d4387b..730e2f0 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -1187,7 +1187,7 @@ _Py_Specialize_BinarySubscr(
assert(cls->tp_version_tag != 0);
cache0->version = cls->tp_version_tag;
int version = _PyFunction_GetVersionForCurrentState(func);
- if (version == 0) {
+ if (version == 0 || version != (uint16_t)version) {
SPECIALIZATION_FAIL(BINARY_SUBSCR, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
}