Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate false positive causes panic #30

Closed
quackduck opened this issue Apr 30, 2022 · 5 comments
Closed

Duplicate false positive causes panic #30

quackduck opened this issue Apr 30, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@quackduck
Copy link

https://github.com/TwiN/go-away/blob/master/goaway.go#L178

runtime error: slice bounds out of range [457:451]

@TwiN
Copy link
Owner

TwiN commented Apr 30, 2022

@quackduck With what string did this happen, so that I can replicate it on my end?

@quackduck
Copy link
Author

I couldn't find the exact string but this has the same effect:

panic: runtime error: slice bounds out of range [392:380]

package main

import (
    "github.com/TwiN/go-away"
    "fmt"
)

var text = `pi@raspberrypi:~/Documents/devzat-bot $ yarn
yarn install v1.22.18
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.61s.
pi@raspberrypi:~/Documents/devzat-bot $ yarn start
yarn run v1.22.18
warning package.json: No license field
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
pi@raspberrypi:~/Documents/devzat-bot $`

func main() {
    fmt.Println(goaway.Censor(text))
}

@TwiN
Copy link
Owner

TwiN commented May 1, 2022

Thanks! I was able to reproduce it using the following string:

documentdocument

Basically, it happens when there's two false positives.

This bug appears to have been introduced by #27, which was released as part of v1.6.1. In the meantime, you can use a version older than that.

@TwiN TwiN added the bug Something isn't working label May 1, 2022
@TwiN TwiN changed the title goaway.go:178 panics: slice bounds out of range [457:451] bug: Duplicate false positive causes panic May 1, 2022
@TwiN TwiN changed the title bug: Duplicate false positive causes panic Duplicate false positive causes panic May 1, 2022
@TwiN TwiN closed this as completed in 4453bfc May 1, 2022
@quackduck
Copy link
Author

Epic, thanks!

@TwiN
Copy link
Owner

TwiN commented May 1, 2022

Released in v1.6.3.
Also opened #31 because I discovered another but while working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants