Commit 954c9c5b authored by Alan Mackenzie's avatar Alan Mackenzie

Check by eassert that a bytepos argument isn't in the middle of a character

* src/marker.c (buf_bytepos_to_charpos): Add an eassert to check that the
parameter bytepos is at the beginning of a character or EOB.
parent d2b5f445
Pipeline #901 failed with stage
in 51 minutes and 14 seconds
......@@ -332,6 +332,10 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
if (best_above == best_above_byte)
return bytepos;
/* 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_below = BEG;
best_below_byte = BEG_BYTE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment