Skip to content

Fix an out-of-bounds array access when formatting some empty comment#792

Merged
johnbartholomew merged 2 commits into
google:masterfrom
mickael-carl:mcarl/fix-oob-formatter
Mar 10, 2025
Merged

Fix an out-of-bounds array access when formatting some empty comment#792
johnbartholomew merged 2 commits into
google:masterfrom
mickael-carl:mcarl/fix-oob-formatter

Conversation

@mickael-carl
Copy link
Copy Markdown
Contributor

@mickael-carl mickael-carl commented Mar 6, 2025

Also make sure to use default options in tests, to be consistent with what jsonnetfmt actually does.

Quick reproducer of the issue:

$ echo "#
  {}" | jsonnetfmt -
panic: runtime error: index out of range [1] with length 1

@mickael-carl mickael-carl force-pushed the mcarl/fix-oob-formatter branch from 75d0155 to 106c8f0 Compare March 6, 2025 23:49
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 55.46% (+1.9%) from 53.571%
when pulling 106c8f0 on mickael-carl:mcarl/fix-oob-formatter
into 5b5bcd5 on google:master.

@johnbartholomew
Copy link
Copy Markdown
Collaborator

Thanks for finding and fixing this!

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

Successfully merging this pull request may close these issues.

3 participants