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
d61f586d
Commit
d61f586d
authored
Oct 29, 2018
by
Zackery Spytz
Committed by
Serhiy Storchaka
Oct 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.7] bpo-35068: Fix possible crashes in pyexpat.c. (GH-10099)
parent
41c7f973
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
Modules/pyexpat.c
Modules/pyexpat.c
+11
-17
No files found.
Modules/pyexpat.c
View file @
d61f586d
...
@@ -1084,21 +1084,7 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
...
@@ -1084,21 +1084,7 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
return
NULL
;
return
NULL
;
new_parser
->
buffer_size
=
self
->
buffer_size
;
new_parser
->
buffer_size
=
self
->
buffer_size
;
new_parser
->
buffer_used
=
0
;
new_parser
->
buffer_used
=
0
;
if
(
self
->
buffer
!=
NULL
)
{
new_parser
->
buffer
=
NULL
;
new_parser
->
buffer
=
malloc
(
new_parser
->
buffer_size
);
if
(
new_parser
->
buffer
==
NULL
)
{
#ifndef Py_TPFLAGS_HAVE_GC
/* Code for versions 2.0 and 2.1 */
PyObject_Del
(
new_parser
);
#else
/* Code for versions 2.2 and later. */
PyObject_GC_Del
(
new_parser
);
#endif
return
PyErr_NoMemory
();
}
}
else
new_parser
->
buffer
=
NULL
;
new_parser
->
returns_unicode
=
self
->
returns_unicode
;
new_parser
->
returns_unicode
=
self
->
returns_unicode
;
new_parser
->
ordered_attributes
=
self
->
ordered_attributes
;
new_parser
->
ordered_attributes
=
self
->
ordered_attributes
;
new_parser
->
specified_attributes
=
self
->
specified_attributes
;
new_parser
->
specified_attributes
=
self
->
specified_attributes
;
...
@@ -1120,6 +1106,14 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
...
@@ -1120,6 +1106,14 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
return
PyErr_NoMemory
();
return
PyErr_NoMemory
();
}
}
if
(
self
->
buffer
!=
NULL
)
{
new_parser
->
buffer
=
malloc
(
new_parser
->
buffer_size
);
if
(
new_parser
->
buffer
==
NULL
)
{
Py_DECREF
(
new_parser
);
return
PyErr_NoMemory
();
}
}
XML_SetUserData
(
new_parser
->
itself
,
(
void
*
)
new_parser
);
XML_SetUserData
(
new_parser
->
itself
,
(
void
*
)
new_parser
);
/* allocate and clear handlers first */
/* allocate and clear handlers first */
...
@@ -1310,6 +1304,8 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
...
@@ -1310,6 +1304,8 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
self
->
in_callback
=
0
;
self
->
in_callback
=
0
;
self
->
ns_prefixes
=
0
;
self
->
ns_prefixes
=
0
;
self
->
handlers
=
NULL
;
self
->
handlers
=
NULL
;
self
->
intern
=
intern
;
Py_XINCREF
(
self
->
intern
);
if
(
namespace_separator
!=
NULL
)
{
if
(
namespace_separator
!=
NULL
)
{
self
->
itself
=
XML_ParserCreateNS
(
encoding
,
*
namespace_separator
);
self
->
itself
=
XML_ParserCreateNS
(
encoding
,
*
namespace_separator
);
}
}
...
@@ -1327,8 +1323,6 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
...
@@ -1327,8 +1323,6 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
XML_SetHashSalt
(
self
->
itself
,
XML_SetHashSalt
(
self
->
itself
,
(
unsigned
long
)
_Py_HashSecret
.
prefix
);
(
unsigned
long
)
_Py_HashSecret
.
prefix
);
#endif
#endif
self
->
intern
=
intern
;
Py_XINCREF
(
self
->
intern
);
#ifdef Py_TPFLAGS_HAVE_GC
#ifdef Py_TPFLAGS_HAVE_GC
PyObject_GC_Track
(
self
);
PyObject_GC_Track
(
self
);
#else
#else
...
...
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