From 05b250c2c0063fadbfc345ee0866da0fd846f939 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 25 Mar 2014 22:35:38 -0700 Subject: [PATCH] Fix core dump in char-equal. * editfns.c (Fchar_equal): Do not use MAKE_CHAR_MULTIBYTE in unibyte buffers, as we can't tell whether the characters are actually unibyte. Fixes: debbugs:17011 --- src/ChangeLog | 5 +++++ src/editfns.c | 15 +++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 72d9f60002a..bf27ece6af7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2014-03-26 Paul Eggert + Fix core dump in char-equal (Bug#17011). + * editfns.c (Fchar_equal): Do not use MAKE_CHAR_MULTIBYTE in + unibyte buffers, as we can't tell whether the characters are + actually unibyte. + * insdel.c (adjust_markers_for_delete): Remove unused local. 2014-03-24 Barry O'Reilly diff --git a/src/editfns.c b/src/editfns.c index 5018020a11b..1986ee53d23 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4377,18 +4377,13 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) if (NILP (BVAR (current_buffer, case_fold_search))) return Qnil; + /* FIXME: When enable-multibyte-characters is nil, it's still possible + to manipulate multibyte chars, which means there is a bug for chars + in the range 128-255 as we can't tell whether they are eight-bit + bytes or Latin-1 chars. For now, assume the latter. See Bug#17011. + Also see casefiddle.c's casify_object, which has a similar problem. */ i1 = XFASTINT (c1); - if (NILP (BVAR (current_buffer, enable_multibyte_characters)) - && ! ASCII_CHAR_P (i1)) - { - MAKE_CHAR_MULTIBYTE (i1); - } i2 = XFASTINT (c2); - if (NILP (BVAR (current_buffer, enable_multibyte_characters)) - && ! ASCII_CHAR_P (i2)) - { - MAKE_CHAR_MULTIBYTE (i2); - } return (downcase (i1) == downcase (i2) ? Qt : Qnil); } -- 2.39.2