From owner-svn-src-all@freebsd.org Tue Feb 19 21:58:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D09414DB4EE; Tue, 19 Feb 2019 21:58:24 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E451762A2; Tue, 19 Feb 2019 21:58:24 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C51123DBD; Tue, 19 Feb 2019 21:58:24 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JLwNBX028388; Tue, 19 Feb 2019 21:58:23 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JLwNVo028387; Tue, 19 Feb 2019 21:58:23 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201902192158.x1JLwNVo028387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 19 Feb 2019 21:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344309 - head/sys/teken X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/sys/teken X-SVN-Commit-Revision: 344309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E451762A2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 21:58:24 -0000 Author: ed Date: Tue Feb 19 21:58:23 2019 New Revision: 344309 URL: https://svnweb.freebsd.org/changeset/base/344309 Log: Place an upper bound on the number of iterations for REP. Right now it's possible to invoke the REP escape sequence with a maximum of tens of millions of iterations. In practice, there is never any need to do this. Calling it more frequently than the number of cells in the terminal hardly makes any sense. By placing a limit on it, we can prevent users from exhausting resources in inside the terminal emulator. As support for this escape sequence is not present in any of the stable branches, there is no need to MFC. Reported by: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11255 Modified: head/sys/teken/teken_subr.h Modified: head/sys/teken/teken_subr.h ============================================================================== --- head/sys/teken/teken_subr.h Tue Feb 19 21:49:48 2019 (r344308) +++ head/sys/teken/teken_subr.h Tue Feb 19 21:58:23 2019 (r344309) @@ -1337,8 +1337,11 @@ teken_subr_vertical_position_absolute(teken_t *t, unsi static void teken_subr_repeat_last_graphic_char(teken_t *t, unsigned int rpts) { + unsigned int max_repetitions; + max_repetitions = t->t_winsize.tp_row * t->t_winsize.tp_col; + if (rpts > max_repetitions) + rpts = max_repetitions; for (; t->t_last != 0 && rpts > 0; rpts--) teken_subr_regular_character(t, t->t_last); } -