diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2022-08-23 10:13:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 10:13:53 (GMT) |
commit | 16ebae4cd4029205d932751f26c719c6cb8a6e92 (patch) | |
tree | 6eed2767cf1fe3eaf6e1ee1b48890691ac25bc71 /Objects/codeobject.c | |
parent | ba7d4b9dc18777e1d3ad2bfc9d935e45e47ebe00 (diff) | |
download | cpython-16ebae4cd4029205d932751f26c719c6cb8a6e92.zip cpython-16ebae4cd4029205d932751f26c719c6cb8a6e92.tar.gz cpython-16ebae4cd4029205d932751f26c719c6cb8a6e92.tar.bz2 |
GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes (GH-96188)
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index aeb6a8c..72712f4 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -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; } |