-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Validate All Py_* Functions in C Extensions check for NULL #49756
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
Comments
Does it have to check From a "quick and dirty" check, here's a couple I found: pandas/pandas/_libs/src/ujson/python/date_conversions.c Lines 92 to 117 in 009c4c6
pandas/pandas/_libs/src/parser/io.c Line 68 in 348d43f
pandas/pandas/_libs/src/ujson/python/JSONtoObj.c Lines 240 to 244 in 2410fca
pandas/pandas/_libs/src/ujson/python/objToJSON.c Lines 185 to 192 in 2f44dba
but I don't know which are allowed and which not. |
Those are all good examples of incorrect code. Yea they should all be checking for NULL |
At least all PyObject* funcs. Other Py* funcs May not return a pointer so could have different requirements (ex: -1 for integral return values) |
ive asked enough times to know this a pipe dream, but this logic would be so much more maintainable if it lived in cython |
@jbrockmendel pointed out in #49034 that we don't consistently validate the return of
Py_*
functions in the C API. The net effect of this is that our extensions are much harder to refactor, as our lack of checks allows at worst for undefined behavior and at best for segfaults.If someone were to audit the extensions we could easily add in error handling where missing and shore up these extensions. See also https://docs.python.org/3/c-api/exceptions.html#
The text was updated successfully, but these errors were encountered: