Skip to content

debug/elf: nil pointer dereference when opening os.Executable() #54227

Closed as not planned
@ulrichSchreiner

Description

@ulrichSchreiner

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

❯ go version
go version go1.19 linux/amd64

Does this issue reproduce with the latest release?

Yes, only with 1.19

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

go env Output
$ go env
GOARCH="amd64"
GOOS="linux"

What did you do?

Compile a oneliner with the library github.com/GeertJohan/go.rice . the binary crashes when starting. Without the import everything is ok. My code works since many years with this library, but with 1.19 every binary crashes immediatly

package main

import (
        "fmt"
        _ "github.com/GeertJohan/go.rice"
)
func main () {
        fmt.Printf("Hello\n")
}

What did you expect to see?

The output Hello

What did you see instead?

❯ go build
❯ ./ricetest
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4c34e6]

goroutine 1 [running]:
debug/elf.(*Section).ReadAt(0xc0001d2000?, {0xc0000fe480?, 0x270?, 0x24?}, 0x40?)
        <autogenerated>:1 +0x26
archive/zip.readDirectoryEnd({0x5e4d40, 0xc0000fad00}, 0x210)
        /usr/local/go/src/archive/zip/reader.go:526 +0xf5
archive/zip.(*Reader).init(0xc0000e6a10, {0x5e4d40?, 0xc0000fad00}, 0x210)
        /usr/local/go/src/archive/zip/reader.go:97 +0x5c
archive/zip.NewReader({0x5e4d40, 0xc0000fad00}, 0x210)
        /usr/local/go/src/archive/zip/reader.go:90 +0x5e
github.com/daaku/go%2ezipexe.zipExeReaderElf({0x5e5040?, 0xc000014048}, 0x42afb5)
        /home/usc/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.0/zipexe.go:128 +0x8b
github.com/daaku/go%2ezipexe.NewReader({0x5e5040, 0xc000014048}, 0x0?)
        /home/usc/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.0/zipexe.go:48 +0x98
github.com/daaku/go%2ezipexe.OpenCloser({0xc00001a440?, 0xc0000c7d10?})
        /home/usc/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.0/zipexe.go:30 +0x57
github.com/GeertJohan/go%2erice.init.0()
        /home/usc/go/pkg/mod/github.com/!geert!johan/go.rice@v1.0.2/appended.go:42 +0x65

Using go 1.18 works fine. but with 1.19 the program crashes in the init function of the library. Perhaps the library is buggy, but there seems to be some incompatiblities

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions