8000 gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485) · python/cpython@a1c57bc · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a1c57bc

Browse files
authored
gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485)
Handle _Unpickler_SetStringInput() failure.
1 parent 9cba47d commit a1c57bc

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
@@ -1288,6 +1288,10 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
12881288
else {
12891289
read_size = _Unpickler_SetStringInput(self, data);
12901290
Py_DECREF(data);
1291+
if (read_size < 0) {
1292+
return -1;
1293+
}
1294+
12911295
self->prefetched_idx = 0;
12921296
if (n <= read_size)
12931297
return n;

0 commit comments

Comments
 (0)
0