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
a49de6be
Commit
a49de6be
authored
Nov 25, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #25725: Fixed a reference leak in pickle.loads() when unpickling
invalid data including tuple instructions.
parent
4f44d537
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
19 deletions
+11
-19
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_pickle.c
Modules/_pickle.c
+8
-19
No files found.
Misc/NEWS
View file @
a49de6be
...
...
@@ -106,6 +106,9 @@ Core and Builtins
Library
-------
- Issue #25725: Fixed a reference leak in pickle.loads() when unpickling
invalid data including tuple instructions.
- Issue #25663: In the Readline completer, avoid listing duplicate global
names, and search the global namespace before searching builtins.
...
...
Modules/_pickle.c
View file @
a49de6be
...
...
@@ -4915,15 +4915,14 @@ load_counted_binunicode(UnpicklerObject *self, int nbytes)
}
static
int
load_
tuple
(
UnpicklerObject
*
self
)
load_
counted_tuple
(
UnpicklerObject
*
self
,
int
len
)
{
PyObject
*
tuple
;
Py_ssize_t
i
;
if
(
(
i
=
marker
(
self
))
<
0
)
return
-
1
;
if
(
Py_SIZE
(
self
->
stack
)
<
len
)
return
stack_underflow
()
;
tuple
=
Pdata_poptuple
(
self
->
stack
,
i
);
tuple
=
Pdata_poptuple
(
self
->
stack
,
Py_SIZE
(
self
->
stack
)
-
len
);
if
(
tuple
==
NULL
)
return
-
1
;
PDATA_PUSH
(
self
->
stack
,
tuple
,
-
1
);
...
...
@@ -4931,24 +4930,14 @@ load_tuple(UnpicklerObject *self)
}
static
int
load_
counted_tuple
(
UnpicklerObject
*
self
,
int
len
)
load_
tuple
(
UnpicklerObject
*
self
)
{
Py
Object
*
tuple
;
Py
_ssize_t
i
;
tuple
=
PyTuple_New
(
len
);
if
(
tuple
==
NULL
)
if
((
i
=
marker
(
self
))
<
0
)
return
-
1
;
while
(
--
len
>=
0
)
{
PyObject
*
item
;
PDATA_POP
(
self
->
stack
,
item
);
if
(
item
==
NULL
)
return
-
1
;
PyTuple_SET_ITEM
(
tuple
,
len
,
item
);
}
PDATA_PUSH
(
self
->
stack
,
tuple
,
-
1
);
return
0
;
return
load_counted_tuple
(
self
,
Py_SIZE
(
self
->
stack
)
-
i
);
}
static
int
...
...
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