Skip to content

Commit 01a15ea

Browse files
committed
Merged revisions 77352-77354 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77352 | antoine.pitrou | 2010-01-07 18:46:49 +0100 (jeu., 07 janv. 2010) | 5 lines Issue #7455: Fix possible crash in cPickle on invalid input. Patch by Florent Xicluna. ........ r77353 | antoine.pitrou | 2010-01-07 18:49:37 +0100 (jeu., 07 janv. 2010) | 3 lines Fix attribution. Florent actually repackaged and reviewed Victor's patch (sorry!). ........ r77354 | antoine.pitrou | 2010-01-07 18:54:10 +0100 (jeu., 07 janv. 2010) | 3 lines Fix reattribution mistake when fixing attribution mistake! ........
1 parent 0bc8f90 commit 01a15ea

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/test/pickletester.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,9 @@ def test_bad_input(self):
11391139
# Test issue4298
11401140
s = bytes([0x58, 0, 0, 0, 0x54])
11411141
self.assertRaises(EOFError, pickle.loads, s)
1142+
# Test issue7455
1143+
s = b'0'
1144+
self.assertRaises(pickle.UnpicklingError, pickle.loads, s)
11421145

11431146

11441147
class AbstractPersistentPicklerTests(unittest.TestCase):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ C-API
194194
Library
195195
-------
196196

197+
- Issue #7455: Fix possible crash in cPickle on invalid input. Patch by
198+
Victor Stinner.
199+
197200
- Issue #1628205: Socket file objects returned by socket.socket.makefile() now
198201
properly handles EINTR within the read, readline, write & flush methods.
199202
The socket.sendall() method now properly handles interrupted system calls.

Modules/_pickle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ load_pop(UnpicklerObject *self)
37293729
*/
37303730
if (self->num_marks > 0 && self->marks[self->num_marks - 1] == len) {
37313731
self->num_marks--;
3732-
} else if (len >= 0) {
3732+
} else if (len > 0) {
37333733
len--;
37343734
Py_DECREF(self->stack->data[len]);
37353735
self->stack->length = len;

0 commit comments

Comments
 (0)