Skip to content

Out of range panic fix#745

Open
artemseleznev wants to merge 1 commit into
prometheus:masterfrom
Infowatch:master
Open

Out of range panic fix#745
artemseleznev wants to merge 1 commit into
prometheus:masterfrom
Infowatch:master

Conversation

@artemseleznev

Copy link
Copy Markdown
Contributor

The Svace static analyzer (https://www.ispras.ru/en/technologies/svace/) flagged this code as suspicious: it could lead to a panic (out of range) if len(out) == 0. It might happen if text would be e.g. "bla:bla"

Signed-off-by: Artem Seleznev <seleznyov.artyom@gmail.com>

@SuperQ SuperQ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's definitely a corrupt input panic here. But do want to continue or error?

@SuperQ

SuperQ commented Oct 21, 2025

Copy link
Copy Markdown
Member

It would also be useful to add some tests.

@discordianfish

Copy link
Copy Markdown
Member

Yeah I feel we should error instead

@SuperQ SuperQ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should return an error, not continue.

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