gh-148222 Fix Null dereference bugs at genericaliasobject.c#148226
gh-148222 Fix Null dereference bugs at genericaliasobject.c#148226prakashsellathurai wants to merge 10 commits intopython:mainfrom
Conversation
Objects/genericaliasobject.c
Outdated
| if (_PyTuple_Resize(¶meters, len) < 0) { | ||
| Py_DECREF(subparams); | ||
| Py_DECREF(parameters); | ||
| Py_XDECREF(parameters); |
There was a problem hiding this comment.
Apparently _PyTuple_Resize sets its arg to NULL on failures, so this will never be non-NULL. Possibly the only safe way to use _PyTuple_Resize is to keep another pointer to the tuple around and DECREF that on failure? I haven't verified in the code though.
There was a problem hiding this comment.
Simply remove this line.
There was a problem hiding this comment.
Objects/genericaliasobject.c
Outdated
| { | ||
| gaobject *alias = (gaobject *) self; | ||
| PyObject *obj = PyVectorcall_Function(alias->origin)(alias->origin, args, nargsf, kwnames); | ||
| vectorcallfunc origin_vectorcall = PyVectorcall_Function(alias->origin); |
There was a problem hiding this comment.
The docs say this is primarily useful for checking whether a callable supports vectorcall. Why don't we unconditionally call PyObject_Vectorcall, which automatically falls back to non-vectorcall if needed?
There was a problem hiding this comment.
makes sense
I checked the code flow PyObject_Vectorcall internally calls https://github.com/python/cpython/blob/main/Include/internal/pycore_call.h#L140-L142 PyVectorcall_Function
i will update the code
Uh oh!
There was an error while loading. Please reload this page.