Skip to content

formatting file with zls causes infinite loop in memory allocator #979

@Jarred-Sumner

Description

@Jarred-Sumner

Zig Version

0.11.0-dev.1393+38eebf3c4

Zig Language Server Version

384f227

Steps to Reproduce

When using zls to format files, it seems to infinite loop on certain input. Generally it seems to be more likely to happen on longer files. zig fmt works as expected.

File that reproduces the issue (too long to fit in an issue)

Expected Behavior

Formats successfully, like zig fmt

Actual Behavior

It infinite loops until it uses enough memory for the OOM killer to kill it. This type of issue is often caused by looping over or duplicating a slice that is undefined, in which cause the len field is something absurdly large (due to undefined memory)

image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions