From: Victor Stinner Date: Wed, 6 Nov 2024 13:24:46 +0000 (+0100) Subject: gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485) X-Git-Tag: v3.14.0a2~152 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a1c57bcfd2bcbc55ff858407e09c1d8d8cee44e6;p=thirdparty%2FPython%2Fcpython.git gh-126461: Fix _Unpickler_ReadFromFile() error handling (#126485) Handle _Unpickler_SetStringInput() failure. --- diff --git a/Modules/_pickle.c b/Modules/_pickle.c index b2bd9545c1b1..863da6878409 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1288,6 +1288,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;