golang / go

The Go programming language

Home Page:https://go.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fmt: index out of range (6)

dvyukov opened this issue · comments

The following program crashes with the panic:

package main
import "fmt"
func main() {
    fmt.Printf("%*.100U\n", -100, 1)
}
panic: runtime error: index out of range

goroutine 1 [running]:
fmt.(*fmt).integer(0xc8200aa6d8, 0x1, 0x10, 0x0, 0x518b50, 0x10)
    go/src/fmt/format.go:271 +0x6a0
fmt.(*pp).fmtUnicode(0xc8200aa680, 0x1)
    go/src/fmt/print.go:406 +0xc1
fmt.(*pp).fmtInt64(0xc8200aa680, 0x1, 0xc800000055)
    go/src/fmt/print.go:375 +0x46
fmt.(*pp).printArg(0xc8200aa680, 0x4beac0, 0xc82000a430, 0x55, 0x0, 0x0)
    go/src/fmt/print.go:770 +0xe53
fmt.(*pp).doPrintf(0xc8200aa680, 0x50c850, 0x8, 0xc82007bf28, 0x2, 0x2)
    go/src/fmt/print.go:1197 +0x1e9d
fmt.Fprintf(0x7efe418ca1c0, 0xc820068010, 0x50c850, 0x8, 0xc82007bf28, 0x2, 0x2, 0x40b160, 0x0, 0x0)
    go/src/fmt/print.go:188 +0x74
fmt.Printf(0x50c850, 0x8, 0xc82007bf28, 0x2, 0x2, 0x12000a410, 0x0, 0x0)
    go/src/fmt/print.go:197 +0x94
main.main()
    fmt.go:4 +0x14d

go version devel +514014c Thu Jun 18 15:54:35 2015 +0200 linux/amd64

CL https://golang.org/cl/11405 mentions this issue.