Skip to content

runtime error: index out of range [4294967295] with length 16 in github.com/klauspost/[email protected]/flate #630

@noxer

Description

@noxer

We've seen a sentry crash in version 1.15.1 of klauspost/compress. The code seems to be essentially the same on master as on v1.15.1 and the history doesn't indicate a fix for this, so I'm opening a new issue.

runtime.boundsError: runtime error: index out of range [4294967295] with length 16
  File "github.com/klauspost/[email protected]/flate/huffman_code.go", line 270, in (*huffmanEncoder).bitCounts
  File "github.com/klauspost/[email protected]/flate/huffman_code.go", line 351, in (*huffmanEncoder).generate
  File "github.com/klauspost/[email protected]/flate/huffman_bit_writer.go", line 823, in (*huffmanBitWriter).generate
  File "github.com/klauspost/[email protected]/flate/huffman_bit_writer.go", line 722, in (*huffmanBitWriter).writeBlockDynamic
  File "github.com/klauspost/[email protected]/flate/deflate.go", line 688, in (*compressor).storeFast
  File "github.com/klauspost/[email protected]/flate/deflate.go", line 704, in (*compressor).write
  File "github.com/klauspost/[email protected]/flate/deflate.go", line 865, in (*Writer).Write
  File "github.com/klauspost/[email protected]/gzip/gzip.go", line 212, in (*Writer).Write
  File "github.com/mattermost/[email protected]/gzip.go", line 104, in (*GzipResponseWriter).Write
  File "io/io.go", line 428, in copyBuffer
  File "io/io.go", line 385, in Copy
  File "io/io.go", line 361, in CopyN
  File "net/http/fs.go", line 337, in serveContent
  File "net/http/fs.go", line 664, in serveFile
  File "net/http/fs.go", line 850, in (*fileHandler).ServeHTTP
  File "net/http/server.go", line 2127, in StripPrefix.func1
  File "net/http/server.go", line 2084, in HandlerFunc.ServeHTTP
  File "github.com/mattermost/mattermost-server/v6/web/static.go", line 91, in staticFilesHandler.func1
  File "net/http/server.go", line 2084, in HandlerFunc.ServeHTTP
  File "github.com/mattermost/[email protected]/gzip.go", line 337, in GzipHandlerWithOpts.func1.1
  File "net/http/server.go", line 2084, in HandlerFunc.ServeHTTP
  File "github.com/gorilla/[email protected]/mux.go", line 210, in (*Router).ServeHTTP
  File "net/http/server.go", line 2084, in HandlerFunc.ServeHTTP
  File "net/http/server.go", line 2916, in serverHandler.ServeHTTP
  File "net/http/server.go", line 1966, in (*conn).serve

OS / Arch

Linux / AMD64

Go version

1.18.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions