Skip to content

Failure on non-ascii input #278

Open
@kian99

Description

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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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