aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2012-09-30 22:25:11 +0900
committerKenichi Handa2012-09-30 22:25:11 +0900
commit95402d5faa114a311cabfb8c64cf22a93787a066 (patch)
treed3a009a5d45c360a4137ec75ab47e0ac3805605a /src
parent51c4474efc354c0e1ecc06c3014e06a3eca9682a (diff)
downloademacs-95402d5faa114a311cabfb8c64cf22a93787a066.tar.gz
emacs-95402d5faa114a311cabfb8c64cf22a93787a066.zip
coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention to the buffer relocation which may be caused by ccl_driver.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/coding.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 676f4127ba5..508ac9925a8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-09-30 Kenichi Handa <handa@gnu.org>
2
3 * coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention
4 to the buffer relocation which may be caused by ccl_driver.
5
12012-09-22 Paul Eggert <eggert@cs.ucla.edu> 62012-09-22 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 * .gdbinit: Just stop at fatal_error_backtrace. 8 * .gdbinit: Just stop at fatal_error_backtrace.
diff --git a/src/coding.c b/src/coding.c
index 4b3d22f956c..40e67b9a6c8 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5106,6 +5106,7 @@ decode_coding_ccl (struct coding_system *coding)
5106 while (1) 5106 while (1)
5107 { 5107 {
5108 const unsigned char *p = src; 5108 const unsigned char *p = src;
5109 ptrdiff_t offset;
5109 int i = 0; 5110 int i = 0;
5110 5111
5111 if (multibytep) 5112 if (multibytep)
@@ -5123,8 +5124,17 @@ decode_coding_ccl (struct coding_system *coding)
5123 5124
5124 if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) 5125 if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK)
5125 ccl->last_block = 1; 5126 ccl->last_block = 1;
5127 /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */
5128 charset_map_loaded = 0;
5126 ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, 5129 ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf,
5127 charset_list); 5130 charset_list);
5131 if (charset_map_loaded
5132 && (offset = coding_change_source (coding)))
5133 {
5134 p += offset;
5135 src += offset;
5136 src_end += offset;
5137 }
5128 charbuf += ccl->produced; 5138 charbuf += ccl->produced;
5129 if (multibytep) 5139 if (multibytep)
5130 src += source_byteidx[ccl->consumed]; 5140 src += source_byteidx[ccl->consumed];
@@ -5177,8 +5187,15 @@ encode_coding_ccl (struct coding_system *coding)
5177 5187
5178 do 5188 do
5179 { 5189 {
5190 ptrdiff_t offset;
5191
5192 /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */
5193 charset_map_loaded = 0;
5180 ccl_driver (ccl, charbuf, destination_charbuf, 5194 ccl_driver (ccl, charbuf, destination_charbuf,
5181 charbuf_end - charbuf, 1024, charset_list); 5195 charbuf_end - charbuf, 1024, charset_list);
5196 if (charset_map_loaded
5197 && (offset = coding_change_destination (coding)))
5198 dst += offset;
5182 if (multibytep) 5199 if (multibytep)
5183 { 5200 {
5184 ASSURE_DESTINATION (ccl->produced * 2); 5201 ASSURE_DESTINATION (ccl->produced * 2);