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
65a3144e
Commit
65a3144e
authored
Jul 01, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #21780: make the unicodedata module "ssize_t clean" for parsing parameters
parent
2e57b4e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
Modules/unicodedata.c
Modules/unicodedata.c
+8
-2
No files found.
Modules/unicodedata.c
View file @
65a3144e
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
------------------------------------------------------------------------ */
------------------------------------------------------------------------ */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "Python.h"
#include "ucnhash.h"
#include "ucnhash.h"
#include "structmember.h"
#include "structmember.h"
...
@@ -1271,12 +1273,16 @@ unicodedata_lookup(PyObject* self, PyObject* args)
...
@@ -1271,12 +1273,16 @@ unicodedata_lookup(PyObject* self, PyObject* args)
Py_UCS4
code
;
Py_UCS4
code
;
char
*
name
;
char
*
name
;
in
t
namelen
;
Py_ssize_
t
namelen
;
unsigned
int
index
;
unsigned
int
index
;
if
(
!
PyArg_ParseTuple
(
args
,
"s#:lookup"
,
&
name
,
&
namelen
))
if
(
!
PyArg_ParseTuple
(
args
,
"s#:lookup"
,
&
name
,
&
namelen
))
return
NULL
;
return
NULL
;
if
(
namelen
>
INT_MAX
)
{
PyErr_SetString
(
PyExc_KeyError
,
"name too long"
);
return
NULL
;
}
if
(
!
_getcode
(
self
,
name
,
namelen
,
&
code
,
1
))
{
if
(
!
_getcode
(
self
,
name
,
(
int
)
namelen
,
&
code
,
1
))
{
PyErr_Format
(
PyExc_KeyError
,
"undefined character name '%s'"
,
name
);
PyErr_Format
(
PyExc_KeyError
,
"undefined character name '%s'"
,
name
);
return
NULL
;
return
NULL
;
}
}
...
...
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