Permalink
Browse files

gc: put limit on size of exported recursive interface

Prevents edge-case recursive types from consuming excessive memory.

Fixes #1909.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5504108
  • Loading branch information...
lorenzo-stoakes authored and rsc committed Jan 9, 2012
1 parent 2cb6fcf commit aa63a928ea6b2fb6b2edb10fd8d98c98f20d5274
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/cmd/gc/fmt.c
@@ -1450,7 +1450,7 @@ Tconv(Fmt *fp)
if(t == T)
return fmtstrcpy(fp, "<T>");

if(t->trecur > 4)
if(t->trecur > 4 || fp->nfmt > 1000)
return fmtstrcpy(fp, "<...>");

t->trecur++;

0 comments on commit aa63a92

Please sign in to comment.