summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-10-04 14:23:20 +0300
committerEli Zaretskii <eliz@gnu.org>2022-10-04 14:23:20 +0300
commitd52d6e1e106117eb4bba81a65e256e2e793037b6 (patch)
tree02250adfecf9d717ede4a80b76b0f47d08b0b517 /src/editfns.c
parent9fb0aaa1ce4ed0050d2e13552f078a563c8a20ed (diff)
downloademacs-d52d6e1e106117eb4bba81a65e256e2e793037b6.tar.gz
emacs-d52d6e1e106117eb4bba81a65e256e2e793037b6.tar.bz2
emacs-d52d6e1e106117eb4bba81a65e256e2e793037b6.zip
Avoid assertion violations in STRING_CHAR
* src/xdisp.c (handle_composition_prop): * src/editfns.c (styled_format): Don't call 'STRING_CHAR' on unibyte strings. This avoids assertion violation in 'string_char_and_length'.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c
index b774e79337f..c1414071c79 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3552,7 +3552,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
|| conversion == 'o' || conversion == 'x'
|| conversion == 'X'))
error ("Invalid format operation %%%c",
- STRING_CHAR ((unsigned char *) format - 1));
+ multibyte_format
+ ? STRING_CHAR ((unsigned char *) format - 1)
+ : *((unsigned char *) format - 1));
else if (! (FIXNUMP (arg) || ((BIGNUMP (arg) || FLOATP (arg))
&& conversion != 'c')))
error ("Format specifier doesn't match argument type");