summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index af98a90..9dc96da 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -396,7 +396,11 @@ PyObject *PyUnicode_FromUnicode(const Py_UNICODE *u,
PyObject *PyUnicode_FromString(const char *u)
{
PyUnicodeObject *unicode;
- Py_ssize_t size = strlen(u);
+ size_t size = strlen(u);
+ if (size > PY_SSIZE_T_MAX) {
+ PyErr_SetString(PyExc_OverflowError, "input too long");
+ return NULL;
+ }
/* If the Unicode data is known at construction time, we can apply
some optimizations which share commonly used objects. */