diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-06 23:58:36 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-06 23:58:36 (GMT) |
commit | 2740e460897cf9efcdb8c83076fd640016f007d4 (patch) | |
tree | 6f09ec299654067ea342f2176aaed25aadf6e2a2 /Objects | |
parent | c083476bded14e52c8498aabca4c07557c4f01ab (diff) | |
download | cpython-2740e460897cf9efcdb8c83076fd640016f007d4.zip cpython-2740e460897cf9efcdb8c83076fd640016f007d4.tar.gz cpython-2740e460897cf9efcdb8c83076fd640016f007d4.tar.bz2 |
_PyUnicodeWriter: assert that max character <= MAX_UNICODE
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index b96333c..9ecf0e1 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13348,6 +13348,8 @@ _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer, Py_ssize_t newlen; PyObject *newbuffer; + assert(maxchar <= MAX_UNICODE); + /* ensure that the _PyUnicodeWriter_Prepare macro was used */ assert((maxchar > writer->maxchar && length >= 0) || length > 0); @@ -13441,6 +13443,7 @@ _PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer, Py_LOCAL_INLINE(int) _PyUnicodeWriter_WriteCharInline(_PyUnicodeWriter *writer, Py_UCS4 ch) { + assert(ch <= MAX_UNICODE); if (_PyUnicodeWriter_Prepare(writer, 1, ch) < 0) return -1; PyUnicode_WRITE(writer->kind, writer->data, writer->pos, ch); |