[issue24917] time_strftime() Buffer Over-read

John Leitch report at bugs.python.org
Sat Sep 5 04:16:17 CEST 2015


John Leitch added the comment:

I plucked the error message from the % operator:

>>> '%' % 'foo'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: incomplete format
>>> '%z' % 'foo'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unsupported format character 'z' (0x7a) at index 1

That said, it should be more consistent. I went with the latter suggestion since it's more informative. An updated patch is attached.

As for platform compatibility, I'd certainly feel better if someone could test the Sun/AIX changes. Unfortunately, I'm unable to do so. It's interesting that OSX accepts "%". As per the spec, "%%" is a "%" literal, and the behavior of invalid tokens such as "%" is undefined.

----------
Added file: http://bugs.python.org/file40368/time_strftime_Buffer_Over-read_v3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24917>
_______________________________________


More information about the Python-bugs-list mailing list