Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
be92971b
Commit
be92971b
authored
Apr 15, 2013
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #17710: Fix cPickle raising a SystemError on bogus input.
parent
108d1b4a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
Lib/pickle.py
Lib/pickle.py
+1
-1
Lib/test/pickletester.py
Lib/test/pickletester.py
+2
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/cPickle.c
Modules/cPickle.c
+6
-4
No files found.
Lib/pickle.py
View file @
be92971b
...
...
@@ -962,7 +962,7 @@ class Unpickler:
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
...
...
Lib/test/pickletester.py
View file @
be92971b
...
...
@@ -538,6 +538,8 @@ class AbstractPickleTests(unittest.TestCase):
"'abc
\
"
"
,
# open quote and close quote don't match
"'abc' ?"
,
# junk after close quote
"'
\
\
'"
,
# trailing backslash
"'"
,
# issue #17710
"' "
,
# issue #17710
# some tests of the quoting rules
#"'abc\"\''",
#"'\\\\a\'\'\'\\\'\\\\\''",
...
...
Misc/NEWS
View file @
be92971b
...
...
@@ -28,6 +28,8 @@ Core and Builtins
Library
-------
-
Issue
#
17710
:
Fix
cPickle
raising
a
SystemError
on
bogus
input
.
-
Issue
#
17341
:
Include
the
invalid
name
in
the
error
messages
from
re
about
invalid
group
names
.
...
...
Modules/cPickle.c
View file @
be92971b
...
...
@@ -3643,17 +3643,19 @@ load_string(Unpicklerobject *self)
/* Strip outermost quotes */
while
(
s
[
len
-
1
]
<=
' '
)
while
(
len
>
0
&&
s
[
len
-
1
]
<=
' '
)
len
--
;
if
(
s
[
0
]
==
'"'
&&
s
[
len
-
1
]
==
'"'
)
{
if
(
len
>
1
&&
s
[
0
]
==
'"'
&&
s
[
len
-
1
]
==
'"'
)
{
s
[
len
-
1
]
=
'\0'
;
p
=
s
+
1
;
len
-=
2
;
}
else
if
(
s
[
0
]
==
'\''
&&
s
[
len
-
1
]
==
'\''
){
}
else
if
(
len
>
1
&&
s
[
0
]
==
'\''
&&
s
[
len
-
1
]
==
'\''
)
{
s
[
len
-
1
]
=
'\0'
;
p
=
s
+
1
;
len
-=
2
;
}
else
}
else
goto
insecure
;
/********************************************/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment