gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485)

Handle _Unpickler_SetStringInput() failure.
This commit is contained in:
Victor Stinner 2024-11-06 14:24:46 +01:00 committed by GitHub
parent 9cba47d9f1
commit a1c57bcfd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -1288,6 +1288,10 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
else {
read_size = _Unpickler_SetStringInput(self, data);
Py_DECREF(data);
if (read_size < 0) {
return -1;
}
self->prefetched_idx = 0;
if (n <= read_size)
return n;