]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: don't crash in size computation for invalid type
authorRobert Griesemer <gri@golang.org>
Sat, 7 May 2022 23:18:57 +0000 (16:18 -0700)
committerGopher Robot <gobot@golang.org>
Sun, 8 May 2022 17:29:15 +0000 (17:29 +0000)
commit3391517c0e4695a87cdb806cbf7b9760e7c9fa73
treebe5aea498cb76b1bbf469aa1d4ae89a1e70e559b
parent1b86ef47de13622f48f76765403f065222d8f584
cmd/compile: don't crash in size computation for invalid type

An invalid program may produce invalid types. If the program
calls unsafe.Sizeof on such a type, which is a compile-time
computation, the size-computation must be able to handle it.
Add the invalid type to the list of permissible basic types
and give it a size of 1 (word).

Fixes #52748.

Change-Id: I6c409628f9b77044758caf71cdcb199f9e77adea
Reviewed-on: https://go-review.googlesource.com/c/go/+/404894
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/noder/sizes.go
test/fixedbugs/issue52748.go [new file with mode: 0644]