From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#20498: 25.0.50; PATCH: break potential infinite loop in (line-move-to-column) Date: Sun, 03 May 2015 12:32:33 -0700 Message-ID: <87k2wp8nji.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1430681549 331 80.91.229.3 (3 May 2015 19:32:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 May 2015 19:32:29 +0000 (UTC) To: 20498@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 03 21:32:17 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yozcc-0002W3-Gd for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 May 2015 21:32:14 +0200 Original-Received: from localhost ([::1]:60124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yozcb-0007k2-Kt for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 May 2015 15:32:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YozcX-0007jd-JA for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 15:32:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YozcS-0003nF-IG for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 15:32:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YozcS-0003nA-FR for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 15:32:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YozcR-0003Su-VJ for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 15:32:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 May 2015 19:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20498 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.143068149113277 (code B ref -1); Sun, 03 May 2015 19:32:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 May 2015 19:31:31 +0000 Original-Received: from localhost ([127.0.0.1]:60958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yozbu-0003S4-7e for submit@debbugs.gnu.org; Sun, 03 May 2015 15:31:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47966) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yozbo-0003Rn-Jg for submit@debbugs.gnu.org; Sun, 03 May 2015 15:31:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yozbi-0003ll-9A for submit@debbugs.gnu.org; Sun, 03 May 2015 15:31:19 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:55698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yozbi-0003lh-67 for submit@debbugs.gnu.org; Sun, 03 May 2015 15:31:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yozbh-0007bs-4F for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 15:31:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yozbc-0003lL-3f for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 15:31:17 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:35360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yozbb-0003lH-Ro for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 15:31:12 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4A1DC209CC for ; Sun, 3 May 2015 15:31:10 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Sun, 03 May 2015 15:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=content-type:date:from:message-id:mime-version:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=K9jlJAmWXoXZP4WRq+eH9Mw4so4 =; b=GUb1jYxroNTsZ7/eIPieBx368+LpsBixiORyzkRkqnRMXaVCWZkBI6VoVJf esRZ30X1G034CyrikhliJOVRMsfhLSfpuEdrhU2Oi8Da4thqsl0YFIGB8CvWY5tT ODacZFBcWaICotfltNkfyHE6HUMl+aA7G+SGCnj1XtduapwA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=K9 jlJAmWXoXZP4WRq+eH9Mw4so4=; b=T6uLkK68vjmKSvcNMs323uG7WtSoL1ePpn Yu2TYFgUmKlCj+hT7pOHM3V36Igw63sjcTljqsXQdaK+JdzNFPZiSOvK41rkiY6B 6SgZW9xqCp3bxix3B6bmch8WxbiE37nWsjxq1Qveo2BG2ohcO2vOIwUTItsiWiRe g420F+FVU= X-Sasl-enc: tDrf9dHYes+Mj1yw/bBleN8U2RrSuDHLhjKIbM/dy5GQ 1430681469 Original-Received: from shorty.local (unknown [104.35.103.243]) by mail.messagingengine.com (Postfix) with ESMTPA id EA9DBC00011 for ; Sun, 3 May 2015 15:31:09 -0400 (EDT) Original-Received: from ip6-localhost ([::1] helo=shorty) by shorty.local with esmtp (Exim 4.84) (envelope-from ) id 1Yozcv-0000CH-El for bug-gnu-emacs@gnu.org; Sun, 03 May 2015 12:32:33 -0700 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:102418 Archived-At: --=-=-= Content-Type: text/plain (line-move-to-column) has a loop that can become infinite: (while (and ...) (goto-char (previous-char-property-change (point) line-beg))) If (= (point) line-beg) then the (goto-char) does nothing, and the condition in the while never changes. This patch adds a check to break out of the while when this happens: (while (and ... (/= (point) line-beg)) (goto-char (previous-char-property-change (point) line-beg))) I'm seeing this in the wild with ERC and erc-fill-mode disabled. Simply moving around an ERC buffer can hit this. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-simple.el-line-move-to-column-break-potential-i.patch >From 4214ce56af49f506729b0240ea1dbb9c588f6215 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 3 May 2015 12:31:13 -0700 Subject: [PATCH] * lisp/simple.el (line-move-to-column): break potential infinite loop (line-move-to-column) has a loop that can become infinite: (while (and ...) (goto-char (previous-char-property-change (point) line-beg))) If (= (point) line-beg) then the (goto-char) does nothing, and the condition in the while never changes. This patch adds a check to break out of the while when this happens: (while (and ... (/= (point) line-beg)) (goto-char (previous-char-property-change (point) line-beg))) I'm seeing this in the wild with ERC and erc-fill-mode disabled. Simply moving around an ERC buffer can hit this. --- lisp/simple.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 31efe38..4873ebd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5962,7 +5962,8 @@ and `current-column' to be able to ignore invisible text." ;; but with a more reasonable buffer position. (goto-char normal-location) (let ((line-beg (line-beginning-position))) - (while (and (not (bolp)) (invisible-p (1- (point)))) + (while (and (not (bolp)) (invisible-p (1- (point))) + (/= (point) line-beg)) (goto-char (previous-char-property-change (point) line-beg)))))))) (defun move-end-of-line (arg) -- 2.1.4 --=-=-=--