diff options
author | Guido van Rossum <guido@python.org> | 2000-06-28 22:07:35 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-06-28 22:07:35 (GMT) |
commit | 582acece2e0db447904b3f8f8f1d2acf36834158 (patch) | |
tree | 80805422d52a32da77e5e93425c34ec48d76a9c6 /Python/modsupport.c | |
parent | 6f2a5efec98c831bd529dfb341c2f83ff0914418 (diff) | |
download | cpython-582acece2e0db447904b3f8f8f1d2acf36834158.zip cpython-582acece2e0db447904b3f8f8f1d2acf36834158.tar.gz cpython-582acece2e0db447904b3f8f8f1d2acf36834158.tar.bz2 |
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
tests.
Diffstat (limited to 'Python/modsupport.c')
-rw-r--r-- | Python/modsupport.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c index 7b40286..13737f1 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -355,8 +355,15 @@ do_mkvalue(p_format, p_va) Py_INCREF(v); } else { - if (n < 0) - n = strlen(str); + if (n < 0) { + size_t m = strlen(str); + if (m > INT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "string too long for Python string"); + return NULL; + } + n = (int)m; + } v = PyString_FromStringAndSize(str, n); } return v; |