GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes (GH-96188)
This commit is contained in:
parent
ba7d4b9dc1
commit
16ebae4cd4
@ -0,0 +1,2 @@
|
||||
Fixed a bug that caused ``_PyCode_GetExtra`` to return garbage for negative
|
||||
indexes. Patch by Pablo Galindo
|
@ -1339,7 +1339,7 @@ _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra)
|
||||
PyCodeObject *o = (PyCodeObject*) code;
|
||||
_PyCodeObjectExtra *co_extra = (_PyCodeObjectExtra*) o->co_extra;
|
||||
|
||||
if (co_extra == NULL || co_extra->ce_size <= index) {
|
||||
if (co_extra == NULL || index < 0 || co_extra->ce_size <= index) {
|
||||
*extra = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user