https://github.com/python/cpython/commit/83827ad81972e8e6438a29274dbdcb923d7b1cc4
commit: 83827ad81972e8e6438a29274dbdcb923d7b1cc4
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2024-11-06T13:51:39Z
summary:

[3.13] gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) 
(#126495)

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 add07d558ab7b6..aa4e21781e23bd 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1287,6 +1287,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]

Reply via email to