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
d2171d2b
Commit
d2171d2b
authored
Nov 06, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overallocate target buffer for normalization more early. Fixes #834676.
Backported to 2.3.
parent
85c20a41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
Lib/test/test_normalization.py
Lib/test/test_normalization.py
+3
-0
Modules/unicodedata.c
Modules/unicodedata.c
+7
-5
No files found.
Lib/test/test_normalization.py
View file @
d2171d2b
...
...
@@ -84,5 +84,8 @@ def test_main():
continue
assert
X
==
NFC
(
X
)
==
NFD
(
X
)
==
NFKC
(
X
)
==
NFKD
(
X
),
c
# Check for bug 834676
normalize
(
'NFC'
,
u'
\
ud55c
\
uae00
'
)
if
__name__
==
"__main__"
:
test_main
()
Modules/unicodedata.c
View file @
d2171d2b
...
...
@@ -311,12 +311,14 @@ nfd_nfkd(PyObject *input, int k)
stack
[
stackptr
++
]
=
*
i
++
;
while
(
stackptr
)
{
Py_UNICODE
code
=
stack
[
--
stackptr
];
if
(
!
space
)
{
space
=
PyString_GET_SIZE
(
result
)
+
10
;
if
(
PyUnicode_Resize
(
&
result
,
space
)
==
-
1
)
/* Hangul Decomposition adds three characters in
a single step, so we need atleast that much room. */
if
(
space
<
3
)
{
int
newsize
=
PyString_GET_SIZE
(
result
)
+
10
;
space
+=
10
;
if
(
PyUnicode_Resize
(
&
result
,
newsize
)
==
-
1
)
return
NULL
;
o
=
PyUnicode_AS_UNICODE
(
result
)
+
space
-
10
;
space
=
10
;
o
=
PyUnicode_AS_UNICODE
(
result
)
+
newsize
-
space
;
}
/* Hangul Decomposition. */
if
(
SBase
<=
code
&&
code
<
(
SBase
+
SCount
))
{
...
...
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