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

x/text/collate: Infinite loop in Collator.Key() triggered by invalid UTF-8 #16391

Closed
enisoc opened this issue Jul 16, 2016 · 0 comments
Closed

Comments

@enisoc
Copy link

enisoc commented Jul 16, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

    go version go1.6.2 linux/amd64
    
  2. What operating system and processor architecture are you using (go env)?

    GOARCH="amd64"
    GOOS="linux"
    
  3. What did you do?

    Passed random binary data into Collator.Key():

    package main
    
    import (
            "golang.org/x/text/collate"
            "golang.org/x/text/language"
    )
    
    func main() {
            input := []byte("\x99\xeb\x9d\x18\xa4G\x84\x04]\x87\xf3\xc6|\xf2'F")
            collator := collate.New(language.English, collate.Loose)
            collator.Key(new(collate.Buffer), input)
    }
  4. What did you expect to see?

    The program should terminate, or the docs for x/text/collate should warn that inputs must be validated before calling Collator.Key().

  5. What did you see instead?

    The call to Collator.Key() never returns. The program eats all available memory. My workstation locks up. My interns laugh at me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants