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

debug/pe: slice bounds out of range #30253

Closed
tklauser opened this issue Feb 15, 2019 · 1 comment
Closed

debug/pe: slice bounds out of range #30253

tklauser opened this issue Feb 15, 2019 · 1 comment
Milestone

Comments

@tklauser
Copy link
Member

tklauser commented Feb 15, 2019

go version devel +d6c5be54a674 Fri Feb 15 00:00:35 2019 +0100 linux/amd64

package main

import (
        "bytes"
        "debug/pe"
)

func main() {
        data := []byte("L\x01\b\x00regi\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x00\x0f\x03" +
                "\v\x01\x02\x18\x00\x0e\x00\x00\x00\x1e\x00\x00\x00\x02\x00\x00\x80\x12\x00\x00" +
                "\x00\x10\x00\x00\x00 \x00\x00\x00\x00@\x00\x00\x10\x00\x00\x00\x02\x00\x00" +
                "\x04\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00" +
                "\x00\x04\x00\x00\x06S\x00\x00\x03\x00\x00\x00\x00\x00 \x00\x00\x10\x00\x00" +
                "\x00\x00\x10\x00\x00\x10\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00" +
                "\x00\x00\x00\x00\x00`\x00\x00x\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x80\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00" +
                "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb8`\x00\x00|\x00\x00\x00" +
                "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "\x00\x00\x00\x00.text\x00\x00\x00d\f\x00\x00\x00\x10\x00\x00" +
                "\x00\x0e\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "`\x00P`.data\x00\x00\x00\x10\x00\x00\x00\x00 \x00\x00" +
                "\x00\x02\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "@\x000\xc0.rdata\x00\x004\x01\x00\x00\x000\x00\x00" +
                "\x00\x02\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "@\x000@.eh_fram\xa0\x03\x00\x00\x00@\x00\x00" +
                "\x00\x04\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "@\x000@.bss\x00\x00\x00\x00`\x00\x00\x00\x00P\x00\x00" +
                "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
                "\x80\x000\xc0.idata\x00\x00x\x03\x00\x00\x00`\x00\x00" +
                "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00" +
                "0\xc0.CRT\x00\x00\x00\x00\x18\x00\x00\x00\x00p\x00\x00\x00\x02" +
                "\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00" +
                "0\xc0.tls\x00\x00\x00\x00 \x00\x00\x00\x00\x80\x00\x00\x00\x02" +
                "\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001\xc9" +
                "H\x895\x1d")
        f, err := pe.NewFile(bytes.NewReader(data))
        if err != nil {
                return
        }
        defer f.Close()
        f.ImportedSymbols()
}

go run crash.go


goroutine 1 [running]:
debug/pe.(*File).ImportedSymbols(0xc00009e000, 0x4d7808, 0xc00009e000, 0x0, 0x0, 0x498ba2)
	/src/go/src/debug/pe/file.go:379 +0xa59
main.main()
	/go/src/github.com/tklauser/go-fuzz-corpus/pe/repro.go:43 +0x102
exit status 2
@gopherbot
Copy link

Change https://golang.org/cl/162859 mentions this issue: debug/pe: prevent slice out of bounds access in (*File).ImportedSymbols

@tklauser tklauser added this to the Go1.13 milestone Feb 15, 2019
@golang golang locked and limited conversation to collaborators Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants