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

[BUG] panic for fmt.Fprintf #6

Open
dirac-lee opened this issue Jul 21, 2023 · 0 comments
Open

[BUG] panic for fmt.Fprintf #6

dirac-lee opened this issue Jul 21, 2023 · 0 comments

Comments

@dirac-lee
Copy link

Here is a bug.

In render.go:244, fmt.Fprintf will panic if buf's cap is not enough. Maybe you can consider use buf.WriteString() in stead, so that it's cap can grow if needed.

runtime error: makeslice: cap out of range
stack=goroutine 1372 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/cloudwego/kitex/pkg/remote/trans.(*svrTransHandler).OnRead.func1()
	/opt/tiger/compile_path/pkg/mod/github.com/cloudwego/[email protected]/pkg/remote/trans/default_server_handler.go:125 +0xcb
panic({0x34c0ac0, 0x3ec5970})
	/usr/local/go/src/runtime/panic.go:838 +0x207
strconv.appendQuotedWith({0xc000832c98, 0x0, 0x2?}, {0x0, 0xb2bd099e05210e}, 0x22, 0xc2?, 0x47?)
	/usr/local/go/src/strconv/quote.go:35 +0x86
strconv.AppendQuote(...)
	/usr/local/go/src/strconv/quote.go:135
fmt.(*fmt).fmtQ(0xc000832c70, {0x0, 0x8?})
	/usr/local/go/src/fmt/format.go:457 +0xe8
fmt.(*pp).fmtString(0xc00147c278?, {0x0?, 0x1a0?}, 0x1a0?)
	/usr/local/go/src/fmt/print.go:452 +0x3a
fmt.(*pp).printArg(0xc000832c30, {0x33cde00?, 0xc0029b9bf0}, 0x71)
	/usr/local/go/src/fmt/print.go:694 +0x60c
fmt.(*pp).doPrintf(0xc000832c30, {0x38910b2, 0x2}, {0xc00147c580?, 0x1, 0x1})
	/usr/local/go/src/fmt/print.go:1026 +0x288
fmt.Fprintf({0x3ec6140, 0xc000d8a6c0}, {0x38910b2, 0x2}, {0xc00147c580, 0x1, 0x1})
	/usr/local/go/src/fmt/print.go:204 +0x75
github.com/luci/go-render/render.(*traverseState).render(0xc00147caf8, 0xc0013cb2c0?, 0x1, {0x33cde00?, 0xc000b91ff8?, 0x0?}, 0x0)
	/opt/tiger/compile_path/pkg/mod/github.com/luci/[email protected]/render/render.go:244 +0xe4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant