Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 901d81e

Browse files
committed
Merged revisions 77355 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r77355 | antoine.pitrou | 2010-01-07 18:57:31 +0100 (jeu., 07 janv. 2010) | 18 lines Merged revisions 77352-77354 via svnmerge from svn+ssh://[email protected]/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 93a5965 commit 901d81e

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
@@ -1142,6 +1142,9 @@ def test_bad_input(self):
11421142
# Test issue4298
11431143
s = bytes([0x58, 0, 0, 0, 0x54])
11441144
self.assertRaises(EOFError, pickle.loads, s)
1145+
# Test issue7455
1146+
s = b'0'
1147+
self.assertRaises(pickle.UnpicklingError, pickle.loads, s)
11451148

11461149

11471150
class AbstractPersistentPicklerTests(unittest.TestCase):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ Core and Builtins
6161
Library
6262
-------
6363

64+
- Issue #7455: Fix possible crash in cPickle on invalid input. Patch by
65+
Victor Stinner.
66+
6467
- Issue #6511: ZipFile now raises BadZipfile (instead of an IOError) when
6568
opening an empty or very small file.
6669

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)