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: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ff5a848db585a90e55c5e21c0f3b739c402bb760;p=thirdparty%2FPython%2Fcpython.git 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 40e56cdced8d..e6fe1fba4e2a 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);