Kaydet (Commit) ff5a848d authored tarafından Victor Stinner's avatar Victor Stinner

Issue #16147: PyUnicode_FromFormatV() now raises an error if the argument of

'%c' is not in the range(0x110000).
üst 3921e90c
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment