mirror of https://github.com/golang/go.git
cmd/gc: more graceful handling of invalid fields in widstruct.
The protection against segfaults does not completely solve crashes and breaks test/fixedbugs/bug365.go R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6615058
This commit is contained in:
parent
54191126e4
commit
caff439820
|
|
@ -54,8 +54,11 @@ widstruct(Type *errtype, Type *t, vlong o, int flag)
|
|||
for(f=t->type; f!=T; f=f->down) {
|
||||
if(f->etype != TFIELD)
|
||||
fatal("widstruct: not TFIELD: %lT", f);
|
||||
if(f->type == T)
|
||||
break;
|
||||
if(f->type == T) {
|
||||
// broken field, just skip it so that other valid fields
|
||||
// get a width.
|
||||
continue;
|
||||
}
|
||||
dowidth(f->type);
|
||||
if(f->type->align > maxalign)
|
||||
maxalign = f->type->align;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ struct Type
|
|||
uchar copyany;
|
||||
uchar local; // created in this file
|
||||
uchar deferwidth;
|
||||
uchar broke;
|
||||
uchar broke; // broken type definition.
|
||||
uchar isddd; // TFIELD is ... argument
|
||||
uchar align;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue