mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
[3.9] bpo-43499: Restrict co_code to be under INT_MAX in codeobject (GH-20628) (GH-24896)
(cherry picked from commit 3b3b83c965
)
This commit is contained in:
parent
1f0cde6784
commit
db73376106
2 changed files with 11 additions and 1 deletions
|
@ -397,7 +397,9 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno, void *Py_UNUSED(ignore
|
|||
return -1;
|
||||
}
|
||||
|
||||
int len = PyBytes_GET_SIZE(f->f_code->co_code)/sizeof(_Py_CODEUNIT);
|
||||
/* PyCode_NewWithPosOnlyArgs limits co_code to be under INT_MAX so this
|
||||
* should never overflow. */
|
||||
int len = (int)(PyBytes_GET_SIZE(f->f_code->co_code) / sizeof(_Py_CODEUNIT));
|
||||
int *lines = marklines(f->f_code, len);
|
||||
if (lines == NULL) {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue