summaryrefslogtreecommitdiff
path: root/src/cmd/gc/sinit.c
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-05-14 18:49:42 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-05-14 18:50:46 +0200
commit39b34e75d2776044e6d771c808ddf5043db5a0fd (patch)
tree1563b8215307a1c3684da43eb372cc8740fed148 /src/cmd/gc/sinit.c
parent75cafdb248f321775838731e79fbdc0db4ffdd1b (diff)
parentefcc50dfdc94c82ee0292bf71992ecb7c0123061 (diff)
downloadgolang-39b34e75d2776044e6d771c808ddf5043db5a0fd.tar.gz
Merge branch 'upstream-sid' into debian-sid
Conflicts: lib/codereview/codereview.py lib/time/zoneinfo.zip src/pkg/go/types/testdata/expr1.src test/fixedbugs/issue5105.dir/a.go test/fixedbugs/issue5260.dir/a.go In the end, I extracted go1.1.src.tar.gz and used cp -r /tmp/go/* . To be honest, I still don’t understand why git-import-orig yields merge errors at all or how that workflow is supposed to work. If someone could enlighten me, I’d be happy.
Diffstat (limited to 'src/cmd/gc/sinit.c')
-rw-r--r--src/cmd/gc/sinit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/gc/sinit.c b/src/cmd/gc/sinit.c
index 353fc00ce..f8c61828c 100644
--- a/src/cmd/gc/sinit.c
+++ b/src/cmd/gc/sinit.c
@@ -801,7 +801,8 @@ maplit(int ctxt, Node *n, Node *var, NodeList **init)
{
Node *r, *a;
NodeList *l;
- int nerr, b;
+ int nerr;
+ int64 b;
Type *t, *tk, *tv, *t1;
Node *vstat, *index, *value;
Sym *syma, *symb;
@@ -1142,7 +1143,10 @@ stataddr(Node *nam, Node *n)
l = getlit(n->right);
if(l < 0)
break;
- nam->xoffset += l*n->type->width;
+ // Check for overflow.
+ if(n->type->width != 0 && MAXWIDTH/n->type->width <= l)
+ break;
+ nam->xoffset += l*n->type->width;
nam->type = n->type;
return 1;
}