unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 41520@debbugs.gnu.org, stefan@marxist.se, Pip Cet <pipcet@gmail.com>
Subject: bug#41520: 28.0.50; Crash in character.h due to assertion error
Date: Sun, 27 Sep 2020 16:36:21 +0200	[thread overview]
Message-ID: <87wo0f1e3e.fsf@gnus.org> (raw)
In-Reply-To: <837dx0vysk.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 25 May 2020 18:07:07 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> I'm attaching a patch with a few more cases. I don't have a strong
>> preference for either FETCH_BYTE or FETCH_CHAR where both will do, but
>> we should be consistent.
>
> I'm okay with those additional changes, but let's install them on
> master, as they are a cleanup, not a bug.

Pip's patch from May no longer applies cleanly, so I've respun it for
the trunk now.

Does this still look OK?

diff --git a/src/cmds.c b/src/cmds.c
index 90526612b7..c29cf00dad 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -390,7 +390,7 @@ internal_self_insert (int c, EMACS_INT n)
 		     by spaces so that the remaining text won't move.  */
 		  ptrdiff_t actual = PT_BYTE;
 		  actual -= prev_char_len (actual);
-		  if (FETCH_CHAR (actual) == '\t')
+		  if (FETCH_BYTE (actual) == '\t')
 		    /* Rather than add spaces, let's just keep the tab. */
 		    chars_to_delete--;
 		  else
diff --git a/src/syntax.c b/src/syntax.c
index 066972e6d8..cbef61dfbe 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -731,7 +731,6 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
     {
       rarely_quit (++quit_count);
 
-      ptrdiff_t temp_byte;
       int prev_syntax;
       bool com2start, com2end, comstart;
 
@@ -882,8 +881,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
 	  if (open_paren_in_column_0_is_defun_start
               && NILP (Vcomment_use_syntax_ppss)
 	      && (from == stop
-		  || (temp_byte = dec_bytepos (from_byte),
-		      FETCH_CHAR (temp_byte) == '\n')))
+		  || (FETCH_BYTE (from_byte - 1) == '\n')))
 	    {
 	      defun_start = from;
 	      defun_start_byte = from_byte;
diff --git a/src/xdisp.c b/src/xdisp.c
index 3d40878be6..ecd23e0d0f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10619,7 +10619,7 @@ DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_siz
       while (bpos > BEGV_BYTE)
 	{
 	  dec_both (&start, &bpos);
-	  c = FETCH_CHAR (bpos);
+	  c = FETCH_BYTE (bpos);
 	  if (!(c == ' ' || c == '\t'))
 	    break;
 	}
@@ -10641,7 +10641,7 @@ DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_siz
       while (bpos > BEGV_BYTE)
 	{
 	  dec_both (&end, &bpos);
-	  c = FETCH_CHAR (bpos);
+	  c = FETCH_BYTE (bpos);
 	  if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
 	    break;
 	}
@@ -22277,7 +22277,7 @@ trailing_whitespace_p (ptrdiff_t charpos)
   int c = 0;
 
   while (bytepos < ZV_BYTE
-	 && (c = FETCH_CHAR (bytepos),
+	 && (c = FETCH_BYTE (bytepos),
 	     c == ' ' || c == '\t'))
     ++bytepos;
 


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  parent reply	other threads:[~2020-09-27 14:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  7:05 bug#41520: 28.0.50; Crash in character.h due to assertion error Stefan Kangas
2020-05-25  7:28 ` Pip Cet
2020-05-25  7:41   ` Pip Cet
2020-05-25 14:18   ` Eli Zaretskii
2020-05-25 14:30     ` Pip Cet
2020-05-25 15:07       ` Eli Zaretskii
2020-05-25 15:16         ` Pip Cet
2020-05-25 16:09           ` Eli Zaretskii
2020-05-25 17:54             ` Pip Cet
2020-05-25 19:30               ` Eli Zaretskii
2020-05-25 20:39                 ` Pip Cet
2020-05-26 16:17                   ` Eli Zaretskii
2020-09-27 14:36         ` Lars Ingebrigtsen [this message]
2020-09-27 15:15           ` Eli Zaretskii
2020-09-27 15:42             ` Lars Ingebrigtsen
2020-09-27 16:00               ` Eli Zaretskii

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=87wo0f1e3e.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=41520@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=pipcet@gmail.com \
    --cc=stefan@marxist.se \
    /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).