Subject: bug#24378: [PATCH 1/6] Don’t use FETCH_MULTIBYTE_CHAR when advancing index

From: Michal Nazarewicz <[email-masked]>
Date: Tue, 6 Sep 2016 15:31:29 +0200

* src/casefiddle.c (casify_region): use STRING_CHAR_AND_LENGTH as a safe
alternative to FETCH_MULTIBYTE_CHAR which is documented in src/buffer.h
as unsafe when used for advancing index.
---
 src/casefiddle.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/casefiddle.c b/src/casefiddle.c
index 6114a6f..5456eac 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -223,10 +223,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
       int c2, len;
 
       if (multibyte)
-	{
-	  c = FETCH_MULTIBYTE_CHAR (start_byte);
-	  len = CHAR_BYTES (c);
-	}
+	c = STRING_CHAR_AND_LENGTH (BYTE_POS_ADDR(start_byte), len);
       else
 	{
 	  c = FETCH_BYTE (start_byte);
-- 
2.8.0.rc3.226.g39d4020