Skip to content

Out-of-bounds in strformat #19107

@christoph-ehm

Description

@christoph-ehm

The ampersand macro allows for an out-of-bounds-access of f at two places. This happens, when a single brace is not closed properly. With high probability, this is not noticed but there is little probability that no error message occurs.

if f[i] == ':':

I'm a very new learner of Nim so that I don't know the software quality standards for Nim's library code but I think the readability of this macro (and the other big thing in the file) is not good. The unfortunate combination of missing parentheses with 2-space indentation makes it hard for me to see the end of big blocks. It's low-level spaghetti code but could have historical reasons. Better variable names and outlining procedures could improve the readability.

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