From: Eli Zaretskii Date: Sat, 9 Jul 2022 10:16:12 +0000 (+0300) Subject: Fix segfault in composite.c X-Git-Tag: emacs-29.0.90~1447^2~821^2~15 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a740608453525c7f7645df0740ee8267b43a779b;p=emacs.git Fix segfault in composite.c * src/composite.c (find_automatic_composition): Don't use narrowed_begv if it's zero. This avoids segfault in BACKWARD_CHAR, since zero is not a valid buffer position. --- diff --git a/src/composite.c b/src/composite.c index d8998b5a1f3..4f7b4b0a2c7 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1590,7 +1590,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, ptrdiff_t backlim, /* In buffers with very long lines, this function becomes very slow. Pretend that the buffer is narrowed to make it fast. */ narrowed_begv = get_narrowed_begv (w); - if (pos > narrowed_begv) + if (narrowed_begv && pos > narrowed_begv) head = narrowed_begv; cur.pos_byte = CHAR_TO_BYTE (cur.pos); cur.p = BYTE_POS_ADDR (cur.pos_byte);