mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
tests.
This commit is contained in:
parent
6f2a5efec9
commit
582acece2e
9 changed files with 40 additions and 21 deletions
|
@ -83,11 +83,16 @@ static
|
|||
PyObject *normalizestring(const char *string)
|
||||
{
|
||||
register int i;
|
||||
int len = strlen(string);
|
||||
size_t len = strlen(string);
|
||||
char *p;
|
||||
PyObject *v;
|
||||
|
||||
v = PyString_FromStringAndSize(NULL, len);
|
||||
if (len > INT_MAX) {
|
||||
PyErr_SetString(PyExc_OverflowError, "string is too large");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v = PyString_FromStringAndSize(NULL, (int)len);
|
||||
if (v == NULL)
|
||||
return NULL;
|
||||
p = PyString_AS_STRING(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue