Skip to content

Commit

Permalink
[3.12] gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-12…
Browse files Browse the repository at this point in the history
…6485) (#126496)

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

Handle _Unpickler_SetStringInput() failure.
(cherry picked from commit a1c57bc)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
miss-islington and vstinner authored Nov 6, 2024
1 parent e6fd40b commit 97ab3cf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,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;
Expand Down

0 comments on commit 97ab3cf

Please sign in to comment.