Skip to content

reflect: map updates not working #48357

Closed
@randall77

Description

@randall77

This program crashes:

package main

import "reflect"

type T [129]byte

func main() {
	m := map[string]T{}
	v := reflect.ValueOf(m)
	v.SetMapIndex(reflect.ValueOf("a"), reflect.ValueOf(T{}))
	g = m["a"]
}

var g T

CL 345486 introduced a new optimization path to call the _fast map operations on string keys. But the fast operations also require the value to be <=128 bytes. When we violate that, bad things happen.

@dsnet

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions