From b084415e278d54c6f9ee8406b1af8adc2364576c Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 28 Jun 2014 09:24:01 +0200 Subject: Fixes: debbugs:17865 * coding.c (encode_coding_utf_8): Correctly count produced_chars also in unibyte case. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 654e39c0e3d..bd4a8be08b3 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1549,8 +1549,8 @@ encode_coding_utf_8 (struct coding_system *coding) *dst++ = CHAR_TO_BYTE8 (c); else CHAR_STRING_ADVANCE_NO_UNIFY (c, dst); - produced_chars++; } + produced_chars = dst - (coding->destination + coding->produced); } record_conversion_result (coding, CODING_RESULT_SUCCESS); coding->produced_char += produced_chars; -- cgit v1.2.1 From c6ecf7f23d99a7c51a9372fefb261ddca89a1db2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 30 Jun 2014 18:39:29 +0300 Subject: Fix bug #17881 with infloop in decoding emacs-mule encoded text. src/coding.c (MIN_CHARBUF_SIZE): Enlarge to 32. --- src/coding.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 5dbaf96840a..85a50dad91f 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7266,7 +7266,8 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos) } #define MAX_CHARBUF_SIZE 0x4000 -#define MIN_CHARBUF_SIZE 0x10 +/* emacs-mule decoding requires more than 16 bytes. */ +#define MIN_CHARBUF_SIZE 0x20 #define ALLOC_CONVERSION_WORK_AREA(coding, size) \ do { \ -- cgit v1.2.1