GNU bug report logs -
#9389
23.3.50; unencodable-char-position has buffer relocation problem
Previous Next
Reported by: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Date: Sun, 28 Aug 2011 00:12:02 UTC
Severity: normal
Tags: patch
Found in version 23.3.50
Fixed in version 24.0.93
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 9389 <at> debbugs.gnu.org (full text, mbox):
In article <20110828000802.B9D1B34803A <at> msa103.auone-net.jp>, Kazuhiro Ito <kzhr <at> 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 <at> 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));
This bug report was last modified 13 years and 242 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.