Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOML file that ends with comment crashes #7

Open
katastic opened this issue Jun 10, 2024 · 1 comment
Open

TOML file that ends with comment crashes #7

katastic opened this issue Jun 10, 2024 · 1 comment

Comments

@katastic
Copy link

[data]
    pygmentize = '2' # if we don't do our own

works fine (has newline after comment)

[data]
    pygmentize = '2' # if we don't do our own

crashes with off-by-one error. (github inserts a newline there, there is no newline on the second example after comment)

toml\src\toml\toml.d(1007): index [328] is out of bounds for array of length 328

code here:

void readKeyValue(string[] keys) {
      if (clear()) {
         enforceParser(data[index++] == '=', "Expected '=' after key declaration");
         if (clear!false()) {
            set(keys, readValue());
            // there must be nothing after the key/value declaration except comments and whitespaces
            if (clear!false())
1007:           enforceParser(data[index] == '\n', "Invalid characters after value declaration: " ~ data[index]);
@katastic
Copy link
Author

katastic commented Jun 10, 2024

This TOML might violate the spec, but there should be a proper error then, not a random range violation. I only see warnings about newlines after keyvalue pairs though:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant