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
aa187c68
Commit
aa187c68
authored
Sep 05, 2016
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite unpack_add_info, so it has less memory corruption bugs (closes #27944)
parent
118eb656
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
+24
-22
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_hotshot.c
Modules/_hotshot.c
+21
-22
No files found.
Misc/NEWS
View file @
aa187c68
...
...
@@ -36,6 +36,9 @@ Core and Builtins
Library
-------
-
Issue
#
27944
:
Fix
some
memory
-
corruption
bugs
in
the
log
reading
code
of
the
_hotshot
module
.
-
Issue
#
27934
:
Use
``
float
.
__repr__
``
instead
of
plain
``
repr
``
when
JSON
-
encoding
an
instance
of
a
float
subclass
.
Thanks
Eddie
James
.
...
...
Modules/_hotshot.c
View file @
aa187c68
...
...
@@ -338,34 +338,33 @@ unpack_string(LogReaderObject *self, PyObject **pvalue)
static
int
unpack_add_info
(
LogReaderObject
*
self
)
{
PyObject
*
key
;
PyObject
*
key
=
NULL
;
PyObject
*
value
=
NULL
;
int
err
;
err
=
unpack_string
(
self
,
&
key
);
if
(
!
err
)
{
err
=
unpack_string
(
self
,
&
value
);
if
(
err
)
Py_DECREF
(
key
);
else
{
PyObject
*
list
=
PyDict_GetItem
(
self
->
info
,
key
);
if
(
list
==
NULL
)
{
list
=
PyList_New
(
0
);
if
(
list
==
NULL
)
{
err
=
ERR_EXCEPTION
;
goto
finally
;
}
if
(
PyDict_SetItem
(
self
->
info
,
key
,
list
))
{
Py_DECREF
(
list
);
err
=
ERR_EXCEPTION
;
goto
finally
;
}
Py_DECREF
(
list
);
}
if
(
PyList_Append
(
list
,
value
))
err
=
ERR_EXCEPTION
;
if
(
err
)
goto
finally
;
err
=
unpack_string
(
self
,
&
value
);
if
(
err
)
goto
finally
;
PyObject
*
list
=
PyDict_GetItem
(
self
->
info
,
key
);
if
(
list
==
NULL
)
{
list
=
PyList_New
(
0
);
if
(
list
==
NULL
)
{
err
=
ERR_EXCEPTION
;
goto
finally
;
}
if
(
PyDict_SetItem
(
self
->
info
,
key
,
list
))
{
Py_DECREF
(
list
);
err
=
ERR_EXCEPTION
;
goto
finally
;
}
Py_DECREF
(
list
);
}
if
(
PyList_Append
(
list
,
value
))
err
=
ERR_EXCEPTION
;
finally:
Py_XDECREF
(
key
);
Py_XDECREF
(
value
);
...
...
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