From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Protect against an infloop in python-mode Date: Thu, 23 Mar 2017 22:08:15 +0000 Message-ID: References: <20170228213149.15842-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11436048bf3a0a054b6d1d01 X-Trace: blaine.gmane.org 1490306950 16299 195.159.176.226 (23 Mar 2017 22:09:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Mar 2017 22:09:10 +0000 (UTC) Cc: Philipp Stephani To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 23 23:09:02 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1crAuf-00033y-Hm for ged-emacs-devel@m.gmane.org; Thu, 23 Mar 2017 23:08:57 +0100 Original-Received: from localhost ([::1]:59021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crAul-0000g0-JX for ged-emacs-devel@m.gmane.org; Thu, 23 Mar 2017 18:09:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crAuC-0000fk-O2 for emacs-devel@gnu.org; Thu, 23 Mar 2017 18:08:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1crAuB-0008RR-H3 for emacs-devel@gnu.org; Thu, 23 Mar 2017 18:08:28 -0400 Original-Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:34969) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1crAuB-0008R7-9l for emacs-devel@gnu.org; Thu, 23 Mar 2017 18:08:27 -0400 Original-Received: by mail-wm0-x232.google.com with SMTP id u132so72780117wmg.0 for ; Thu, 23 Mar 2017 15:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JvH2zcJy+WA5oKL0ctaYSlbhInVGJb7kOaXmrIv3CMo=; b=FAs3A59OWQ2dEPdD7D0H2AXGKv36ufIOem39Qtg+Eq5kC6ZVsdVSR8srIzuyhanV11 5faEAsrOvwhTj7nTlQCOjq1Od+eEeXbP3JLoY3vvca4+fqnTlE8N8LPyiEvipmy7Jf65 fEyGE3UvfRWROlPLgSqRSwlL4iBpM4G0myPDDJ905bPddhipSYbhfLEb4804rbTBK967 kBf1Kr45mKX/vkt/cjov78YNhn0JmHY9j0szM2+aVybcO7Nxvn2Uwkdk2ibNZ9I83axs DU/EXmH35upy3swyibraN5lej5sHMPSVEXG4VcQKZJfg9z5s8tzgT8IByo43nB/nDHAd 3UXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JvH2zcJy+WA5oKL0ctaYSlbhInVGJb7kOaXmrIv3CMo=; b=Mie+0A62B/F1NV2CtlJcKd95geDgruwCDMhpwGgTV4+DAU/HVqDPC0k5rDIjI2ULbc M9LopqeRkTW0RztWMy0YqviTGRyu6JSxZ07EWEYN48lp6rS0/MhBGDaiemdSbLpEsYmj dsT6Mx/qMeot7geLNxejau9Q6oKf3c7Vp2osRn+JK6EACEhmtlVP/fQth0JI2MlWIOHc c8oLrStaqzQKRVimHheYBkpag3Fnt1JMgkqx2oTvfLJYRKh5ajSpALILUPM/Ba5YdL2U Xtchk77JQAkQ9e8EUWzu4KCBliYJW7CpreNhNMyciwuINdeLlw/mU/bSIgyRCbOS2w9Y w74g== X-Gm-Message-State: AFeK/H2GIwzlqSvYlyTl90/ErM7XqO47kxmijUCxNd5lKTshfbbzXpEKg3JXdp3NNQWXL9vAfb8c5ZVFofY/KQ== X-Received: by 10.28.44.66 with SMTP id s63mr5025871wms.46.1490306906141; Thu, 23 Mar 2017 15:08:26 -0700 (PDT) In-Reply-To: <20170228213149.15842-1-phst@google.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213279 Archived-At: --001a11436048bf3a0a054b6d1d01 Content-Type: text/plain; charset=UTF-8 Philipp Stephani schrieb am Di., 28. Feb. 2017 um 22:32 Uhr: > There appears to be an edge case caused by using `syntax-ppss' in a > narrowed buffer during JIT lock inside of Python triple-quote strings. > Unfortunately it is impossible to reproduce without manually > destroying the syntactic information in the Python buffer, but it has > been observed in practice. In that case it can happen that the syntax > caches get sufficiently out of whack so that there appear to be > overlapping strings in the buffer. As Python has no nested strings, > this situation is impossible and leads to an infloop in > `python-nav-end-of-statement'. Protect against this by checking > whether the search for the end of the current string makes progress. > > * python.el (python-nav-end-of-statement): Protect against infloop. > * progmodes/python-tests.el > (python-tests--python-nav-end-of-statement--infloop): Add unit test. > Pushed as 4fbd330fae. --001a11436048bf3a0a054b6d1d01 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Philip= p Stephani <p.stephani2@gmail.c= om> schrieb am Di., 28. Feb. 2017 um 22:32=C2=A0Uhr:
There appears to be an edge case caused by using `= syntax-ppss' in a
narrowed buffer during JIT lock inside of Python triple-quote strings.
Unfortunately it is impossible to reproduce without manually
destroying the syntactic information in the Python buffer, but it has
been observed in practice.=C2=A0 In that case it can happen that the syntax=
caches get sufficiently out of whack so that there appear to be
overlapping strings in the buffer.=C2=A0 As Python has no nested strings, this situation is impossible and leads to an infloop in
`python-nav-end-of-statement'.=C2=A0 Protect against this by checking whether the search for the end of the current string makes progress.

* python.el (python-nav-end-of-statement): Protect against infloop.
* progmodes/python-tests.el
(python-tests--python-nav-end-of-statement--infloop): Add unit test.

Pushed as 4fbd330fae.=C2=A0
--001a11436048bf3a0a054b6d1d01--