Skip to content

std.format reads past end of input #10916

@veelo

Description

@veelo

The code below causes an array bounds violation. A FormatException should be thrown instead.

void main()
{
    import std.format, std.exception;
    assertThrown!FormatException(format("%."));
    assertThrown!FormatException(format("%.*"));
}

This is the offending code:

phobos/std/format/spec.d

Lines 459 to 464 in 205256a

case '.':
// Precision
if (trailing[++i] == '*')
{
if (isDigit(trailing[++i]))
{

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions