From: Victor Stinner Date: Sat, 6 Oct 2012 21:05:45 +0000 (+0200) Subject: Issue #16147: PyUnicode_FromFormatV() now raises an error if the argument of X-Git-Tag: v3.4.0a1~2329 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff5a848db585a90e55c5e21c0f3b739c402bb760;p=python Issue #16147: PyUnicode_FromFormatV() now raises an error if the argument of '%c' is not in the range(0x110000). --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 40e56cdced..e6fe1fba4e 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2417,6 +2417,11 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer, case 'c': { int ordinal = va_arg(*vargs, int); + if (ordinal < 0 || ordinal > MAX_UNICODE) { + PyErr_SetString(PyExc_ValueError, + "character argument not in range(0x110000)"); + return NULL; + } if (_PyUnicodeWriter_Prepare(writer, 1, ordinal) == -1) return NULL; PyUnicode_WRITE(writer->kind, writer->data, writer->pos, ordinal);