Issue #17710: Fix pickle raising a SystemError on bogus input.

This commit is contained in:
Antoine Pitrou 2013-04-15 21:55:14 +02:00
commit af94051a93
4 changed files with 15 additions and 5 deletions

View file

@ -903,7 +903,7 @@ class _Unpickler:
orig = self.readline()
rep = orig[:-1]
# Strip outermost quotes
if rep[0] == rep[-1] and rep[0] in b'"\'':
if len(rep) >= 2 and rep[0] == rep[-1] and rep[0] in b'"\'':
rep = rep[1:-1]
else:
raise ValueError("insecure string pickle")