mirror of
https://github.com/golang/go
synced 2024-11-22 19:05:01 -07:00
cmd/gc: compute size of keys & values before making map bucket
Fixes #7547 LGTM=iant R=iant, khr CC=golang-codereviews https://golang.org/cl/84470046
This commit is contained in:
parent
1daa2520bf
commit
375b7bb767
@ -125,6 +125,8 @@ mapbucket(Type *t)
|
||||
|
||||
keytype = t->down;
|
||||
valtype = t->type;
|
||||
dowidth(keytype);
|
||||
dowidth(valtype);
|
||||
if(keytype->width > MAXKEYSIZE)
|
||||
keytype = ptrto(keytype);
|
||||
if(valtype->width > MAXVALSIZE)
|
||||
|
17
test/fixedbugs/issue7547.go
Normal file
17
test/fixedbugs/issue7547.go
Normal file
@ -0,0 +1,17 @@
|
||||
// compile
|
||||
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
func f() map[string]interface{} {
|
||||
var p *map[string]map[string]interface{}
|
||||
_ = p
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
f()
|
||||
}
|
Loading…
Reference in New Issue
Block a user