Skip to content

x/tools/gopls: OOB index crash in github.com/sergi/go-diff/diffmatchpatch #42927

Open
@sicko7947

Description

@sicko7947

gopls version: v0.5.4
gopls flags:

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: index out of range [65533] with length 64335

goroutine 146 [running]:
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffCharsToLines(0xc00a3728c8, 0xc002ea00c0, 0x2, 0x4, 0xc00fd04000, 0xfb4f, 0x12800, 0x13000, 0xbfe999d358b68e70, 0xc85d12f5)
	  diff.go:452  0x334
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).diffLineMode(0xc00a3728c8, 0xc00e3e6044, 0x2a026d, 0x2a07ef, 0xc00ee68044, 0x28eba0, 0x28efef, 0xbfe999d358b68e70, 0xc85d12f5, 0x12dfcc0, ...)
	  diff.go:201  0x1fb
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).diffCompute(0xc00a3728c8, 0xc00e3e6044, 0x2a026d, 0x2a07ef, 0xc00ee68044, 0x28eba0, 0x28efef, 0xa3c001, 0xbfe999d358b68e70, 0xc85d12f5, ...)
	  diff.go:188  0xa92
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).diffMainRunes(0xc00a3728c8, 0xc00e3e6000, 0x2a026e, 0x2a0800, 0xc00ee68044, 0x28eba1, 0x28efef, 0x285401, 0xbfe999d358b68e70, 0xc85d12f5, ...)
	  diff.go:119  0x3bb
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffMainRunes(0xc00a3728c8, 0xc00e3e6000, 0x2a027f, 0x2a0800, 0xc00ee68000, 0x28ebb2, 0x28f000, 0xc000298701, 0x4, 0xc00a3728b8, ...)
	  diff.go:95  0xb2
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffMain(...)
	  diff.go:85
golang.org/x/tools/gopls/internal/hooks.ComputeEdits(0xc0006e2f00, 0x48, 0xc00c280000, 0x2a03b7, 0xc00ccfa000, 0x28ecea, 0x2a03b7, 0x2a05b7, 0xc008940b40)
	  diff.go:14  0x18e
golang.org/x/tools/internal/lsp/source.computeFixEdits(0xe96d00, 0xc004cbc410, 0xc003ef29c0, 0xc008940b40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	  format.go:176  0x2a8
golang.org/x/tools/internal/lsp/source.computeImportEdits(0xe96d00, 0xc004cbc410, 0xc003ef29c0, 0xc008940b40, 0x0, 0x73, 0x0, 0x0, 0x0, 0xc001974d08, ...)
	  format.go:117  0x111
golang.org/x/tools/internal/lsp/source.AllImportsFixes.func1(0xc008940b40, 0xc008940b40, 0xc008940a50)
	  format.go:98  0x6f
golang.org/x/tools/internal/lsp/cache.(*importsState).runProcessEnvFunc(0xc00014d140, 0xe849a0, 0xc008940a50, 0xc004cbc410, 0xc0092a4fc0, 0x0, 0x0)
	  imports.go:103  0x4e7
golang.org/x/tools/internal/lsp/cache.(*snapshot).RunProcessEnvFunc(0xc004cbc410, 0xe849a0, 0xc008940a50, 0xc0092a4fc0, 0xc002658f60, 0x2)
	  view.go:315  0x5d
golang.org/x/tools/internal/lsp/source.AllImportsFixes(0xe849a0, 0xc008940a50, 0xe96d00, 0xc004cbc410, 0xe885e0, 0xc002658f60, 0xe96d00, 0xc004cbc410, 0xe8d700, 0xc002658f60, ...)
	  format.go:97  0x35d
golang.org/x/tools/internal/lsp.(*Server).codeAction(0xc0001bc460, 0xe848e0, 0xc0001423c0, 0xc0090ea180, 0x0, 0x0, 0x0, 0x0, 0x0)
	  code_action.go:84  0x92b
golang.org/x/tools/internal/lsp.(*Server).CodeAction(0xc0001bc460, 0xe848e0, 0xc0001423c0, 0xc0090ea180, 0xc0090ea180, 0x0, 0x0, 0x0, 0xe72320)
	  server_gen.go:12  0x54
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0xe848e0, 0xc0001423c0, 0xe992c0, 0xc0001bc460, 0xc008940300, 0xe84b20, 0xc000142340, 0x0, 0xe72200, 0xc00138ef20)
	  tsserver.go:341  0x20af
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0xe848e0, 0xc0001423c0, 0xc008940300, 0xe84b20, 0xc000142340, 0x85d7dd9d, 0x12dfcc0)
	  protocol.go:63  0xc7
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0xe848e0, 0xc0001423c0, 0xc008940300, 0xe84b20, 0xc000142340, 0x0, 0x0)
	  lsprpc.go:559  0x452
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0xe848e0, 0xc0001423c0, 0xc0004494a0, 0xe84b20, 0xc000142340, 0x38668b, 0xc000296178)
	  handler.go:35  0xda
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc000038480, 0xc0003c3530, 0xc000942090, 0xe848e0, 0xc0001423c0, 0xc0004494a0, 0xe84b20, 0xc000142340)
	  handler.go:103  0x8d
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x179
[Error - 6:25:01 PM] 

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions