Duplicate false positive causes panic #30

Closed
opened 2022-04-30 00:07:18 -04:00 by quackduck · 5 comments
quackduck commented 2022-04-30 00:07:18 -04:00 (Migrated from github.com)

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

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

https://github.com/TwiN/go-away/blob/master/goaway.go#L178 `runtime error: slice bounds out of range [457:451]`
TwiN commented 2022-04-30 14:11:22 -04:00 (Migrated from github.com)

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

@quackduck With what string did this happen, so that I can replicate it on my end?
quackduck commented 2022-04-30 20:22:42 -04:00 (Migrated from github.com)

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))
}
I couldn't find the exact string but this has the same effect: `panic: runtime error: slice bounds out of range [392:380]` ```go 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 commented 2022-05-01 15:33:27 -04:00 (Migrated from github.com)

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.

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](https://github.com/TwiN/go-away/releases/tag/v1.6.1). In the meantime, you can use a version older than that.
quackduck commented 2022-05-01 16:45:30 -04:00 (Migrated from github.com)

Epic, thanks!

Epic, thanks!
TwiN commented 2022-05-01 16:47:52 -04:00 (Migrated from github.com)

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

Released in [v1.6.3](https://github.com/TwiN/go-away/releases/tag/v1.6.3). Also opened #31 because I discovered another but while working on this.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
TwiN/go-away#30
No description provided.