mirror of https://github.com/python/cpython.git
gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485)
Handle _Unpickler_SetStringInput() failure.
This commit is contained in:
parent
9cba47d9f1
commit
a1c57bcfd2
|
@ -1288,6 +1288,10 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
|
||||||
else {
|
else {
|
||||||
read_size = _Unpickler_SetStringInput(self, data);
|
read_size = _Unpickler_SetStringInput(self, data);
|
||||||
Py_DECREF(data);
|
Py_DECREF(data);
|
||||||
|
if (read_size < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
self->prefetched_idx = 0;
|
self->prefetched_idx = 0;
|
||||||
if (n <= read_size)
|
if (n <= read_size)
|
||||||
return n;
|
return n;
|
||||||
|
|
Loading…
Reference in New Issue