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
73c1241f
Commit
73c1241f
authored
Mar 02, 2015
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix possible overflow bugs in unicodedata (closes #23367)
parent
d89fe57b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
Misc/NEWS
Misc/NEWS
+2
-0
Modules/unicodedata.c
Modules/unicodedata.c
+10
-3
No files found.
Misc/NEWS
View file @
73c1241f
...
...
@@ -16,6 +16,8 @@ Core and Builtins
Library
-------
- Issue #23367: Fix possible overflows in the unicodedata module.
- Issue #23361: Fix possible overflow in Windows subprocess creation code.
- Issue #23363: Fix possible overflow in itertools.permutations.
...
...
Modules/unicodedata.c
View file @
73c1241f
...
...
@@ -507,10 +507,17 @@ nfd_nfkd(PyObject *self, PyObject *input, int k)
stackptr
=
0
;
isize
=
PyUnicode_GET_LENGTH
(
input
);
space
=
isize
;
/* Overallocate at most 10 characters. */
space
=
(
isize
>
10
?
10
:
isize
)
+
isize
;
if
(
space
>
10
)
{
if
(
space
<=
PY_SSIZE_T_MAX
-
10
)
space
+=
10
;
}
else
{
space
*=
2
;
}
osize
=
space
;
output
=
PyMem_
Malloc
(
space
*
sizeof
(
Py_UCS4
)
);
output
=
PyMem_
NEW
(
Py_UCS4
,
space
);
if
(
!
output
)
{
PyErr_NoMemory
();
return
NULL
;
...
...
@@ -657,7 +664,7 @@ nfc_nfkc(PyObject *self, PyObject *input, int k)
/* We allocate a buffer for the output.
If we find that we made no changes, we still return
the NFD result. */
output
=
PyMem_
Malloc
(
len
*
sizeof
(
Py_UCS4
)
);
output
=
PyMem_
NEW
(
Py_UCS4
,
len
);
if
(
!
output
)
{
PyErr_NoMemory
();
Py_DECREF
(
result
);
...
...
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