gh-136053: Check error for TYPE_SLICE in marshal.c (GH-136054)

Fix a possible crash when deserializing a large marshal data
(at least several GiBs) containing a slice.
This commit is contained in:
Akshat Gupta 2025-06-29 12:37:24 +05:30 committed by GitHub
parent f04d2b8819
commit 30ba03ea8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -1656,6 +1656,9 @@ r_object(RFILE *p)
case TYPE_SLICE:
{
Py_ssize_t idx = r_ref_reserve(flag, p);
if (idx < 0) {
break;
}
PyObject *stop = NULL;
PyObject *step = NULL;
PyObject *start = r_object(p);