-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set: BUILD_SET
opcode can be failed with segfault
#101952
Comments
cc @gvanrossum Appears to be introduced in #100912 |
Yeah, the original code had
which somehow got lost. How can I repro this? |
If someone could come up with a fix I'll review it, that's the quickest way. |
I can fix it, but i don't know yet how to reproduce it. I was just looking through the |
It's probably hard to repro, because the only way PySet_New() can error is if it runs out of memory. I think restoring those two lines will do it (nothing has been popped off the stack at that point yet). |
Okay, i'll soon send a PR |
cpython/Python/generated_cases.c.h
Lines 1648 to 1667 in 36b139a
&
cpython/Python/bytecodes.c
Lines 1303 to 1316 in 36b139a
Doesn't take in account case, when
PySet_New(NULL)
returns NULL.We are checking that
PySet_Add
doesn't return a non-zero(-1) value.But,
PySet_Add
has a check, that first argument is a subclass ofset
. Which fails, if we will pass(PyObject *) NULL
as first argument. Why?PySet_Add
uses this macross. But,Py_TYPE
will be failed with segfault when try to accessob_type
of(PyObject *) NULL
.Implementation of
Py_TYPE
:So, we should add check, that value of
PySet_New
is not-null.Linked PRs
BUILD_SET
opcode #101958The text was updated successfully, but these errors were encountered: