From aa63a928ea6b2fb6b2edb10fd8d98c98f20d5274 Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Mon, 9 Jan 2012 11:48:53 -0500 Subject: [PATCH] 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 --- src/cmd/gc/fmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/gc/fmt.c b/src/cmd/gc/fmt.c index f3be53c8fbf..3013d0d3293 100644 --- a/src/cmd/gc/fmt.c +++ b/src/cmd/gc/fmt.c @@ -1450,7 +1450,7 @@ Tconv(Fmt *fp) if(t == T) return fmtstrcpy(fp, ""); - if(t->trecur > 4) + if(t->trecur > 4 || fp->nfmt > 1000) return fmtstrcpy(fp, "<...>"); t->trecur++;