https://github.com/python/cpython/commit/97ab3cf3749085f6f42f38180c40aa88ca1b6355 commit: 97ab3cf3749085f6f42f38180c40aa88ca1b6355 branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2024-11-06T13:49:25Z summary:
[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 a1c57bcfd2bcbc55ff858407e09c1d8d8cee44e6) Co-authored-by: Victor Stinner <[email protected]> files: M Modules/_pickle.c diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 879c18263d505e..179500d6956a78 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -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; _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
