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
c5f3b428
Commit
c5f3b428
authored
Nov 25, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #25725: Fixed a reference leak in pickle.loads() when unpickling
invalid data including tuple instructions.
parents
46cc4a8f
a49de6be
Changes
2
Show 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 @
c5f3b428
...
...
@@ -13,6 +13,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 @
c5f3b428
...
...
@@ -4984,15 +4984,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
);
...
...
@@ -5000,24 +4999,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