From owner-svn-src-all@FreeBSD.ORG Sun Sep 13 18:45:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60CBC106568F; Sun, 13 Sep 2009 18:45:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FF758FC18; Sun, 13 Sep 2009 18:45:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DIjx0M028949; Sun, 13 Sep 2009 18:45:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DIjxVV028947; Sun, 13 Sep 2009 18:45:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200909131845.n8DIjxVV028947@svn.freebsd.org> From: Ed Schouten Date: Sun, 13 Sep 2009 18:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197174 - head/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 13 Sep 2009 18:45:59 -0000 Author: ed Date: Sun Sep 13 18:45:59 2009 New Revision: 197174 URL: http://svn.freebsd.org/changeset/base/197174 Log: Make sure we never place the cursor outside the screen. For some vague reason, it may be possible that scp->cursor_pos exceeds scp->ysize * scp->xsize. This means that teken_set_cursor() may get called with an invalid position. Just ignore the old cursor position in this case. Reported by: Paul B. Mahol MFC after: 1 month Modified: head/sys/dev/syscons/scterm-teken.c Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Sun Sep 13 17:45:31 2009 (r197173) +++ head/sys/dev/syscons/scterm-teken.c Sun Sep 13 18:45:59 2009 (r197174) @@ -137,9 +137,12 @@ scteken_init(scr_stat *scp, void **softc tp.tp_col = scp->xsize; teken_set_winsize(&ts->ts_teken, &tp); - tp.tp_row = scp->cursor_pos / scp->xsize; - tp.tp_col = scp->cursor_pos % scp->xsize; - teken_set_cursor(&ts->ts_teken, &tp); + if (scp->cursor_pos < scp->ysize * scp->xsize) { + /* Valid old cursor position. */ + tp.tp_row = scp->cursor_pos / scp->xsize; + tp.tp_col = scp->cursor_pos % scp->xsize; + teken_set_cursor(&ts->ts_teken, &tp); + } break; }