homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients amaury.forgeotdarc, vstinner
Date 2011年01月05日.00:46:25
SpamBayes Score 2.2200014e-07
Marked as misclassified No
Message-id <1294188403.72.0.24360709681.issue10829@psf.upfronthosting.co.za>
In-reply-to
Content
Steps 1 and 3 of PyUnicode_FromFormatV() doesn't handle the format string "%%" correctly. The loop responsible to skip the precision moves outside the format string, and the function will then read uninitialized memory. The loop:
 while (*++f && *f != '%' && !Py_ISALPHA((unsigned)*f))
 ;
This is another issue:
 for (f = format; *f; f++) {
 if (*f == '%') {
 if (*(f+1)=='%')
 continue;
 ...
continue only skips the first %: with "%%", the second % will be interpreted (and not escaped).
Attached patch fixes the issue, but I don't feal confortable with this ugly function, and I would appreciate a review :-) The patch adds unit tests.
I found the bug when trying to add new tests before trying to implement "%zi" format. I was first surprised that "%zi" (and %li and %lli) is not supported, but now I am surprised because I found bugs :-)
History
Date User Action Args
2011年01月05日 00:46:43vstinnersetrecipients: + vstinner, amaury.forgeotdarc
2011年01月05日 00:46:43vstinnersetmessageid: <1294188403.72.0.24360709681.issue10829@psf.upfronthosting.co.za>
2011年01月05日 00:46:25vstinnerlinkissue10829 messages
2011年01月05日 00:46:25vstinnercreate

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