Skip to content

Commit 97ab3cf

Browse files
[3.12] gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) (#126496)
gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) Handle _Unpickler_SetStringInput() failure. (cherry picked from commit a1c57bc) Co-authored-by: Victor Stinner <[email protected]>
1 parent e6fd40b commit 97ab3cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Modules/_pickle.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,10 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
13441344
else {
13451345
read_size = _Unpickler_SetStringInput(self, data);
13461346
Py_DECREF(data);
1347+
if (read_size < 0) {
1348+
return -1;
1349+
}
1350+
13471351
self->prefetched_idx = 0;
13481352
if (n <= read_size)
13491353
return n;

0 commit comments

Comments
 (0)