bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9389: 23.3.50; unencodable-char-position has buffer relocation probl


From: Kenichi Handa
Subject: bug#9389: 23.3.50; unencodable-char-position has buffer relocation problem
Date: Sun, 11 Dec 2011 21:27:22 +0900

In article <20110828000802.B9D1B34803A@msa103.auone-net.jp>, Kazuhiro Ito 
<kzhr@d1.dion.ne.jp> writes:

> When I start precompiled Windows binary with -Q and evaluate below
> code, I have unexpected result.

> (with-temp-buffer
>   (insert (make-string 16 ?A))
>   (insert #x80)
>   (unencodable-char-position 1 18 'ctext-unix))

> -> 13 (Emacs 23.1)
> -> 5  (Emacs 23.3)

> If I evaluate it twice, it returns expected result (17).

> I think the cause of the problem is similar to bug#9318.
> unencodable-char-position uses char_charset(), which could cause a
> relocation of buffes.  After using it, pointers must be updated as
> needed.

You are right.  I've just installed the attached patch
(which is a little bit different from yours).

---
Kenichi Handa
handa@m17n.org


=== modified file 'src/coding.c'
--- src/coding.c        2011-12-08 05:54:20 +0000
+++ src/coding.c        2011-12-11 11:14:15 +0000
@@ -8756,6 +8756,7 @@
     }
 
   positions = Qnil;
+  charset_map_loaded = 0;
   while (1)
     {
       int c;
@@ -8783,6 +8784,16 @@
        }
 
       from++;
+      if (charset_map_loaded && NILP (string))
+       {
+         p = CHAR_POS_ADDR (from);
+         pend = CHAR_POS_ADDR (to);
+         if (from < GPT && to >= GPT)
+           stop = GPT_ADDR;
+         else
+           stop = pend;
+         charset_map_loaded = 0;
+       }
     }
 
   return (NILP (count) ? Fcar (positions) : Fnreverse (positions));






reply via email to

[Prev in Thread] Current Thread [Next in Thread]