Skip to content

Failure on non-ascii input #278

@kian99

Description

@kian99

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke v0.19.0
When running woke on a file with non-ascii characters, one encounters a runtime error about index out of bounds.
panic: runtime error: index out of range [598] with length 598

goroutine 485 [running]:
github.com/get-woke/woke/pkg/rule.maskInlineIgnore({0xc00017fb80, 0x268})
        /home/kian/go/pkg/mod/github.com/get-woke/woke@v0.19.0/pkg/rule/rule.go:215 +0xea
github.com/get-woke/woke/pkg/rule.(*Rule).FindMatchIndexes(0xc0003183f0, {0xc00017fb80?, 0xc0000b8d20?})
        /home/kian/go/pkg/mod/github.com/get-woke/woke@v0.19.0/pkg/rule/rule.go:36 +0x85
github.com/get-woke/woke/pkg/result.FindResults(0xc0003183f0, {0x7ffe53a39e73, 0x1a}, {0xc00017fb80, 0x268}, 0x71)
        /home/kian/go/pkg/mod/github.com/get-woke/woke@v0.19.0/pkg/result/lineresult.go:48 +0x65
github.com/get-woke/woke/pkg/parser.(*Parser).generateFileFindings(0xc0004ee5d0, 0xc000762008)
        /home/kian/go/pkg/mod/github.com/get-woke/woke@v0.19.0/pkg/parser/findings.go:92 +0xae5
github.com/get-woke/woke/pkg/parser.(*Parser).generateFileFindingsFromFilename(0x0?, {0x7ffe53a39e73?, 0x0?})
        /home/kian/go/pkg/mod/github.com/get-woke/woke@v0.19.0/pkg/parser/findings.go:24 +0xb1
github.com/get-woke/woke/pkg/parser.(*Parser).processFiles.func1({0x7ffe53a39e73?, 0x0?})
        /home/kian/go/pkg/mod/github.com/get-woke/woke@v0.19.0/pkg/parser/parser.go:93 +0x6f
created by github.com/get-woke/woke/pkg/parser.(*Parser).processFiles
        /home/kian/go/pkg/mod/github.com/get-woke/woke@v0.19.0/pkg/parser/parser.go:90 +0x34
make: *** [Makefile:103: woke] Error 2

The error comes from maskInlineIgnore and I'll have a PR up shortly with a proposed fix.

Metadata

Metadata

Assignees

No one assigned

    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