[Python-checkins] r77356 - in python/branches/release31-maint: Lib/test/pickletester.py Misc/NEWS Modules/_pickle.c

antoine.pitrou python-checkins at python.org
Thu Jan 7 19:02:53 CET 2010


Author: antoine.pitrou
Date: Thu Jan  7 19:02:53 2010
New Revision: 77356

Log:
Merged revisions 77355 via svnmerge from 
svn+ssh://pythondev@svn.python.org/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://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!
  ........
................


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Lib/test/pickletester.py
   python/branches/release31-maint/Misc/NEWS
   python/branches/release31-maint/Modules/_pickle.c

Modified: python/branches/release31-maint/Lib/test/pickletester.py
==============================================================================
--- python/branches/release31-maint/Lib/test/pickletester.py	(original)
+++ python/branches/release31-maint/Lib/test/pickletester.py	Thu Jan  7 19:02:53 2010
@@ -1142,6 +1142,9 @@
         # Test issue4298
         s = bytes([0x58, 0, 0, 0, 0x54])
         self.assertRaises(EOFError, pickle.loads, s)
+        # Test issue7455
+        s = b'0'
+        self.assertRaises(pickle.UnpicklingError, pickle.loads, s)
 
 
 class AbstractPersistentPicklerTests(unittest.TestCase):

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Thu Jan  7 19:02:53 2010
@@ -61,6 +61,9 @@
 Library
 -------
 
+- Issue #7455: Fix possible crash in cPickle on invalid input.  Patch by
+  Victor Stinner.
+
 - Issue #6511: ZipFile now raises BadZipfile (instead of an IOError) when
   opening an empty or very small file.
 

Modified: python/branches/release31-maint/Modules/_pickle.c
==============================================================================
--- python/branches/release31-maint/Modules/_pickle.c	(original)
+++ python/branches/release31-maint/Modules/_pickle.c	Thu Jan  7 19:02:53 2010
@@ -3729,7 +3729,7 @@
      */
     if (self->num_marks > 0 && self->marks[self->num_marks - 1] == len) {
         self->num_marks--;
-    } else if (len >= 0) {
+    } else if (len > 0) {
         len--;
         Py_DECREF(self->stack->data[len]);
         self->stack->length = len;


More information about the Python-checkins mailing list