unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 3552@debbugs.gnu.org
Subject: bug#3552: 23.0.94; backward-prefix-chars: Point before start of properties
Date: Sun, 5 Jun 2016 09:35:50 -0400	[thread overview]
Message-ID: <CAM-tV-8YLtFSy1TMVRM_V+VE6eJjxN1vZvmvaXuqscBHy6h_XA@mail.gmail.com> (raw)
In-Reply-To: <5753D686.1020204@gmx.at>

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

forcemerge 3552 17132 19379
quit


On Sun, Jun 5, 2016 at 3:36 AM, martin rudalics <rudalics@gmx.at> wrote:
> Make it
>
> * src/syntax.c (Fbackward_prefix_chars): Stop the loop when beginning of
> buffer is reached (Bug#3552, Bug#19379).

Heh, seeing that I decided to search the bug database for
backwards-prefix-chars and found also Bug #17132. Updated patch
attached.

[-- Attachment #2: 0001-Fbackward_prefix_chars-stay-within-buffer-bounds.patch --]
[-- Type: text/x-diff, Size: 1297 bytes --]

From 985874ebcfae96983857e819f570cac3551052c7 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 4 Jun 2016 09:02:20 -0400
Subject: [PATCH] Fbackward_prefix_chars: stay within buffer bounds

The commit 1fd3172d "(Fbackward_prefix_chars): Set point properly while
scanning" (1998-03-18), moved the check against of the position against the
buffer beginning out the loop condition so that we might end up checking
the syntax of characters before the beginning of the buffer.  This can
cause segfaults or trigger a "Point before start of properties" error in
`update_interval' (called indirectly from `char_quoted').

* src/syntax.c (Fbackward_prefix_chars): Stop the loop when beginning of
buffer is reached (Bug #3552, Bug #17132, Bug #19379).
---
 src/syntax.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/syntax.c b/src/syntax.c
index 8e14bf3..b1ba5c6 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3109,8 +3109,9 @@ DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
       opoint = pos;
       opoint_byte = pos_byte;
 
-      if (pos + 1 > beg)
-	DEC_BOTH (pos, pos_byte);
+      if (pos <= beg)
+        break;
+      DEC_BOTH (pos, pos_byte);
     }
 
   SET_PT_BOTH (opoint, opoint_byte);
-- 
2.8.0


  reply	other threads:[~2016-06-05 13:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 10:40 bug#3552: 23.0.94; backward-prefix-chars: Point before start of properties Johan =?UTF-8?Q?Bockg=C3=A5rd
2016-06-03  3:34 ` Noam Postavsky
2016-06-04 13:35   ` Noam Postavsky
2016-06-04 15:22     ` Noam Postavsky
2016-06-04 17:55       ` Eli Zaretskii
2016-06-04 21:25         ` Noam Postavsky
2016-06-05  7:36           ` martin rudalics
2016-06-05 13:35             ` Noam Postavsky [this message]
2016-06-16  2:07               ` Noam Postavsky
2016-06-16 15:05                 ` Eli Zaretskii
2016-06-17  3:20                   ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM-tV-8YLtFSy1TMVRM_V+VE6eJjxN1vZvmvaXuqscBHy6h_XA@mail.gmail.com \
    --to=npostavs@users.sourceforge.net \
    --cc=3552@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).