cpython: bfd8b5d35f9c (original) (raw)

Mercurial > cpython

changeset 72623:bfd8b5d35f9c

PyUnicode_Join() checks output length in debug mode PyUnicode_CopyCharacters() may copies less character than requested size, if the input string is smaller than the argument. (This is very unlikely, but who knows!?) Avoid also calling PyUnicode_CopyCharacters() if the string is empty.

Victor Stinner victor.stinner@haypocalc.com
date Mon, 03 Oct 2011 23:36:02 +0200
parents bf6dbd1b10b4
children 65ff63a8347b
files Objects/unicodeobject.c
diffstat 1 files changed, 22 insertions(+), 10 deletions(-)[+] [-] Objects/unicodeobject.c 32

line wrap: on

line diff

--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8890,20 +8890,32 @@ PyUnicode_Join(PyObject separator, PyOb / Catenate everything. */ for (i = 0, res_offset = 0; i < seqlen; ++i) {

+#ifdef Py_DEBUG

+#else res_offset += seplen;

+#endif

+#ifdef Py_DEBUG

+#else

+#endif