Skip to content

x/net/spdy: makeslice: len out of range #10547

Description

@dvyukov

The following program crashes when run with GOARCH=386:

package main

import (
    "bytes"
    "encoding/hex"
    "golang.org/x/net/spdy"
    "io/ioutil"
)

func main() {
    data, _ := hex.DecodeString("80300004303000278000f42a")
    framer, err := spdy.NewFramer(ioutil.Discard, bytes.NewReader(data))
    if err != nil {
        panic(err)
    }
    for score := 0; ; score++ {
        f, err := framer.ReadFrame()
        if err != nil {
            if f != nil {
                panic(err)
            }
            return
        }
        err = framer.WriteFrame(f)
        if err != nil {
            panic(err)
        }
    }
}
panic: runtime error: makeslice: len out of range

goroutine 1 [running]:
runtime.gopanic(0x8260000, 0x1860a310)
    src/runtime/panic.go:477 +0x337 fp=0x1863de38 sp=0x1863ddf4
runtime.makeslice(0x8218700, 0x8000f42a, 0x0, 0x8000f42a, 0x0, 0x0, 0x0, 0x0)
    src/runtime/slice.go:26 +0xb7 fp=0x1863de64 sp=0x1863de38
golang.org/x/net/spdy.(*SettingsFrame).read(0x18610cc0, 0x40030, 0x18610c30, 0x300027, 0x18612540, 0x0, 0x0)
    src/golang.org/x/net/spdy/read.go:46 +0x129 fp=0x1863dec4 sp=0x1863de64
golang.org/x/net/spdy.(*Framer).parseControlFrame(0x18612540, 0x40030, 0x0, 0x0, 0x0, 0x0)
    src/golang.org/x/net/spdy/read.go:171 +0x1a1 fp=0x1863df1c sp=0x1863dec4
golang.org/x/net/spdy.(*Framer).ReadFrame(0x18612540, 0x0, 0x0, 0x0, 0x0)
    src/golang.org/x/net/spdy/read.go:154 +0x128 fp=0x1863df64 sp=0x1863df1c
main.main()
    spdy.go:17 +0x13f fp=0x1863dfc8 sp=0x1863df64

on commit 6f62f426de90c0ed6a55207b51476115fcb17237

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions