mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.10] GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes (GH-96188). (#96210)
(cherry picked from commit 16ebae4cd4
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
d23ab79952
commit
a6c3f6d347
2 changed files with 3 additions and 1 deletions
|
@ -1304,7 +1304,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…
Add table
Add a link
Reference in a new issue