commit | be92971b38c68fe472d908bdc8aa185963473308 | [log] [tgz] |
---|---|---|
author | Antoine Pitrou <solipsis@pitrou.net> | Mon Apr 15 21:35:25 2013 +0200 |
committer | Antoine Pitrou <solipsis@pitrou.net> | Mon Apr 15 21:35:25 2013 +0200 |
tree | 1cefffe3434e8449aa95701bb466ae8573df3129 | |
parent | 108d1b4a7962a7777b7fb6108f12df619ea9218b [diff] [blame] |
Issue #17710: Fix cPickle raising a SystemError on bogus input.
diff --git a/Lib/pickle.py b/Lib/pickle.py index 5b95cba..508e858 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py
@@ -962,7 +962,7 @@ rep = self.readline()[:-1] for q in "\"'": # double or single quote if rep.startswith(q): - if not rep.endswith(q): + if len(rep) < 2 or not rep.endswith(q): raise ValueError, "insecure string pickle" rep = rep[len(q):-len(q)] break