Avoid segfaults if someone sets 'composition-function-table' to nil
* src/composite.c (composition_compute_stop_pos) (composition_reseat_it): Recreate 'composition-function-table' if it ever becomes garbled. (Bug#80462)
This commit is contained in:
@@ -1101,6 +1101,9 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
|
||||
|
||||
/* Look for automatic compositions. */
|
||||
start = charpos;
|
||||
/* For the case that they set it to something weird, like nil. */
|
||||
if (!CHAR_TABLE_P (Vcomposition_function_table))
|
||||
Vcomposition_function_table = Fmake_char_table (Qnil, Qnil);
|
||||
if (charpos < endpos)
|
||||
{
|
||||
/* Forward search. */
|
||||
@@ -1324,6 +1327,9 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
|
||||
Lisp_Object lgstring = Qnil;
|
||||
Lisp_Object val, elt, direction = Qnil;
|
||||
|
||||
/* For the case that they set it to something weird, like nil. */
|
||||
if (!CHAR_TABLE_P (Vcomposition_function_table))
|
||||
Vcomposition_function_table = Fmake_char_table (Qnil, Qnil);
|
||||
val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch);
|
||||
for (EMACS_INT i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user