[Issue 17281] New: std.format.format should not allow nonsensical format specifiers

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Mar 28 09:44:33 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17281

          Issue ID: 17281
           Summary: std.format.format should not allow nonsensical format
                    specifiers
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: hsteoh at quickfur.ath.cx

Currently, the documentation for std.format.format states that specifiers
consist of '%' followed by optional Position, optional Flags, optional Width,
optional Precision, and finally the format character.

However, the actual implementation is far more lax, and allows nonsensical
specifiers such as the following:

------
import std.stdio;
void main() {
        writefln("%3+-.3#-+-.3---+++###s", "WAT");
}
------

The implementation ought to be cleaned up to reject such nonsensical format
strings.

--


More information about the Digitalmars-d-bugs mailing list