mirror of https://github.com/golang/go.git
gc: reject large channel values at compile time
Fixes #144. R=ken2 CC=agl1 https://golang.org/cl/156102
This commit is contained in:
parent
a6e1ad2733
commit
d116a32727
|
|
@ -186,6 +186,18 @@ dowidth(Type *t)
|
|||
case TCHAN: // implemented as pointer
|
||||
w = widthptr;
|
||||
checkwidth(t->type);
|
||||
|
||||
// make fake type to check later to
|
||||
// trigger channel argument check.
|
||||
t1 = typ(TCHANARGS);
|
||||
t1->type = t;
|
||||
checkwidth(t1);
|
||||
break;
|
||||
case TCHANARGS:
|
||||
t1 = t->type;
|
||||
dowidth(t->type); // just in case
|
||||
if(t1->type->width >= (1<<16))
|
||||
yyerror("channel element type too large (>64kB)");
|
||||
break;
|
||||
case TMAP: // implemented as pointer
|
||||
w = widthptr;
|
||||
|
|
|
|||
|
|
@ -441,6 +441,7 @@ enum
|
|||
|
||||
// pseudo-type for frame layout
|
||||
TFUNCARGS,
|
||||
TCHANARGS,
|
||||
|
||||
NTYPE,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue