diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-10-06 21:05:45 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-10-06 21:05:45 (GMT) |
commit | ff5a848db585a90e55c5e21c0f3b739c402bb760 (patch) | |
tree | bae07e11bf8daa3008f98f6bdafc01d693216b8a | |
parent | 3921e90c5a658179a90ffcf378f245aa9ca33208 (diff) | |
download | cpython-ff5a848db585a90e55c5e21c0f3b739c402bb760.zip cpython-ff5a848db585a90e55c5e21c0f3b739c402bb760.tar.gz cpython-ff5a848db585a90e55c5e21c0f3b739c402bb760.tar.bz2 |
Issue #16147: PyUnicode_FromFormatV() now raises an error if the argument of
'%c' is not in the range(0x110000).
-rw-r--r-- | Objects/unicodeobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 40e56cd..e6fe1fb 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); |