Message256075
'countformat' does not appear to be handling the case where a format string is passed with no parenthesis or brackets correctly. Here is an
example of a usage that might cause issues from typedobject.c:
static PyObject*
slot_sq_slice(PyObject *self, Py_ssize_t i, Py_ssize_t j)
{
static PyObject *getslice_str;
if (PyErr_WarnPy3k("in 3.x, __getslice__ has been removed; "
"use __getitem__", 1) < 0)
return NULL;
return call_method(self, "__getslice__", &getslice_str,
"nn", i, j); <<<<<<< Maybe Bad Format Str <<<<<<<
}
The format string "nn" does not have any level markers so when it gets
processed by 'countformat' the count will be incremented 2 times by the
'default' case but when the end of the string is reached and the NULL character is processed bay "case '\0':". The function will ignore the count variable and just return -1 anyway. The error created is unmatched paren in format but 'level' is never checked to see if a paren
was even hit to begin with.
It might be that the case should be changed to look at level before assuming a error condition if strings are supposed to be processed as the one in the example above. case '\0' should probably be doing something like:
case '\0':
if (level > 0) { // Check If Level Was Incremented
/* Premature end */
PyErr_SetString(PyExc_SystemError,
"unmatched paren in format");
return -1;
}
break; |
|
Date |
User |
Action |
Args |
2015-12-07 21:55:15 | myronww | set | recipients:
+ myronww |
2015-12-07 21:55:15 | myronww | set | messageid: <1449525315.43.0.771475082927.issue25817@psf.upfronthosting.co.za> |
2015-12-07 21:55:15 | myronww | link | issue25817 messages |
2015-12-07 21:55:15 | myronww | create | |
|