changeset: 79544:5e319fdab563 user: Victor Stinner date: Sat Oct 06 23:05:45 2012 +0200 files: Objects/unicodeobject.c description: Issue #16147: PyUnicode_FromFormatV() now raises an error if the argument of '%c' is not in the range(0x110000). diff -r d1369daeb9ec -r 5e319fdab563 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Sat Oct 06 23:05:00 2012 +0200 +++ b/Objects/unicodeobject.c Sat Oct 06 23:05:45 2012 +0200 @@ -2417,6 +2417,11 @@ 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);

AltStyle によって変換されたページ (->オリジナル) /