aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-09-19 23:28:12 -0400
committerRuss Cox <rsc@golang.org>2010-09-19 23:28:12 -0400
commitd4baf3ccb7f7b6dd5476b82c480f30d3a2953399 (patch)
tree1ecdd3cc0d0a357d2e11691e127bde68a857c2c4
parente76934261449e82857fa060dbd3212492b08e2ea (diff)
downloadgo-d4baf3ccb7f7b6dd5476b82c480f30d3a2953399.tar.gz
go-d4baf3ccb7f7b6dd5476b82c480f30d3a2953399.zip
runtime: better panic for send to nil channel
*Much* better on NaCl, where memory faults are deadly. R=r CC=golang-dev https://golang.org/cl/2249041
-rw-r--r--src/pkg/runtime/chan.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c
index 16c02e8e78..436f8b1401 100644
--- a/src/pkg/runtime/chan.c
+++ b/src/pkg/runtime/chan.c
@@ -403,6 +403,9 @@ void
int32 o;
byte *ae;
+ if(c == nil)
+ panicstring("send to nil channel");
+
o = rnd(sizeof(c), c->elemalign);
ae = (byte*)&c + o;
chansend(c, ae, nil);
@@ -416,6 +419,9 @@ void
int32 o;
byte *ae, *ap;
+ if(c == nil)
+ panicstring("send to nil channel");
+
o = rnd(sizeof(c), c->elemalign);
ae = (byte*)&c + o;
o = rnd(o+c->elemsize, Structrnd);