[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Questionable code in handling of wordend in the regexp engine in reg
From: |
Alan Mackenzie |
Subject: |
Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c |
Date: |
Fri, 1 Mar 2019 19:16:07 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hello again, Eli.
On Fri, Mar 01, 2019 at 16:38:25 +0000, Alan Mackenzie wrote:
> On Fri, Mar 01, 2019 at 18:22:39 +0200, Eli Zaretskii wrote:
> > > Date: Fri, 1 Mar 2019 14:58:56 +0000
> > > Cc: address@hidden, address@hidden
> > > From: Alan Mackenzie <address@hidden>
[ .... ]
> > Actually, what I had in mind was a simple
> > eassert (CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos)));
> > right at the beginning of buf_bytepos_to_charpos.
[ .... ]
I'm experimenting with:
diff --git a/src/marker.c b/src/marker.c
index b58051a8c2..89b6ca57f4 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -322,6 +322,9 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
ptrdiff_t distance = BYTECHAR_DISTANCE_INITIAL;
eassert (BUF_BEG_BYTE (b) <= bytepos && bytepos <= BUF_Z_BYTE (b));
+ /* Check bytepos is not in the middle of a character. */
+ eassert (bytepos >= BUF_Z_BYTE (b)
+ || CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos)));
best_above = BUF_Z (b);
best_above_byte = BUF_Z_BYTE (b);
After configuring with --enable-checking and building, I tried make
check. The tests errored out with this bytepos check three times. In:
src/coding-tests.log
lisp/epg-tests.log
lisp/emacs-lisp/package-tests.log
. Quite possibly there is just one bug here, but there might be two or
three. I think it would be best to track it/them down before committing
the change to marker.c.
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Alan Mackenzie, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Stefan Monnier, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Alan Mackenzie, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Alan Mackenzie, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Alan Mackenzie, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c,
Alan Mackenzie <=
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/01
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Alan Mackenzie, 2019/03/02
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/02
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/02
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Alan Mackenzie, 2019/03/02
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/02
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/04
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Alan Mackenzie, 2019/03/05
- Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c, Eli Zaretskii, 2019/03/05