Skip to content

Commit 62a8a0c

Browse files
authored
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
1 parent c5d18a5 commit 62a8a0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/specialize.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ _Py_Specialize_BinarySubscr(
11871187
assert(cls->tp_version_tag != 0);
11881188
cache0->version = cls->tp_version_tag;
11891189
int version = _PyFunction_GetVersionForCurrentState(func);
1190-
if (version == 0) {
1190+
if (version == 0 || version != (uint16_t)version) {
11911191
SPECIALIZATION_FAIL(BINARY_SUBSCR, SPEC_FAIL_OUT_OF_VERSIONS);
11921192
goto fail;
11931193
}

0 commit comments

Comments
 (0)