Skip to content

cmd/link: panic when adding a rsrc section in Windows PE #39658

@tc-hib

Description

@tc-hib

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

go version go1.15beta1 windows/amd64

Does this issue reproduce with the latest release?

not 1.14.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows

What did you do?

I tried to build a Windows exe file with a syso file containing a rsrc section.

What did you expect to see?

An exe file produced without error.

What did you see instead?

panic: runtime error: slice bounds out of range [72:0]

goroutine 1 [running]:
cmd/link/internal/ld.addpersrc(0xc000091500)
        c:/go/src/cmd/link/internal/ld/pe.go:1490 +0x33d
cmd/link/internal/ld.Asmbpe(0xc000091500)
        c:/go/src/cmd/link/internal/ld/pe.go:1568 +0x253
cmd/link/internal/amd64.asmb2(0xc000091500)
        c:/go/src/cmd/link/internal/amd64/asm.go:842 +0xfa
cmd/link/internal/ld.Main(0x121f860, 0x20, 0x20, 0x1, 0x7, 0x10, 0x0, 0x0, 0x107f875, 0x1b, ...)
        c:/go/src/cmd/link/internal/ld/main.go:349 +0x1509
main.main()
        c:/go/src/cmd/link/main.go:68 +0x1fc```

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions