Skip to content

Commit 83827ad

Browse files
[3.13] pythongh-126461: Fix _Unpickler_ReadFromFile() error handling (pythonGH-126485) (python#126495)
pythongh-126461: Fix _Unpickler_ReadFromFile() error handling (pythonGH-126485) Handle _Unpickler_SetStringInput() failure. (cherry picked from commit a1c57bc) Co-authored-by: Victor Stinner <[email protected]>
1 parent 6e9da38 commit 83827ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Modules/_pickle.c

+4
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,10 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
12871287
else {
12881288
read_size = _Unpickler_SetStringInput(self, data);
12891289
Py_DECREF(data);
1290+
if (read_size < 0) {
1291+
return -1;
1292+
}
1293+
12901294
self->prefetched_idx = 0;
12911295
if (n <= read_size)
12921296
return n;

0 commit comments

Comments
 (0)