gh-101952: Fix possible segfault in `BUILD_SET` opcode (#101958)

This commit is contained in:
Eclips4 2023-02-16 20:46:43 +03:00 committed by GitHub
parent 924a3bfa28
commit 68bd8c5e2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -0,0 +1 @@
Fix possible segfault in ``BUILD_SET`` opcode, when new set created.

View File

@ -1302,6 +1302,8 @@ dummy_func(
inst(BUILD_SET, (values[oparg] -- set)) {
set = PySet_New(NULL);
if (set == NULL)
goto error;
int err = 0;
for (int i = 0; i < oparg; i++) {
PyObject *item = values[i];

View File

@ -1649,6 +1649,8 @@
PyObject **values = &PEEK(oparg);
PyObject *set;
set = PySet_New(NULL);
if (set == NULL)
goto error;
int err = 0;
for (int i = 0; i < oparg; i++) {
PyObject *item = values[i];