emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107665: Fix bug #11073 with bidi-rel


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107665: Fix bug #11073 with bidi-related crashes displaying some byte sequences.
Date: Fri, 23 Mar 2012 14:32:23 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107665
fixes bug(s): http://debbugs.gnu.org/11073
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2012-03-23 14:32:23 +0200
message:
  Fix bug #11073 with bidi-related crashes displaying some byte sequences.
  
   src/bidi.c (bidi_fetch_char): Use STRING_CHAR_AND_LENGTH instead of
   FETCH_MULTIBYTE_CHAR followed by CHAR_BYTES.  Prevents crashes
   when fetching a multibyte character consumes more bytes than
   CHAR_BYTES returns, due to unification of CJK characters in
   string_char.
modified:
  src/ChangeLog
  src/bidi.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-03-23 12:23:14 +0000
+++ b/src/ChangeLog     2012-03-23 12:32:23 +0000
@@ -1,3 +1,11 @@
+2012-03-23  Eli Zaretskii  <address@hidden>
+
+       * bidi.c (bidi_fetch_char): Use STRING_CHAR_AND_LENGTH instead of
+       FETCH_MULTIBYTE_CHAR followed by CHAR_BYTES.  Prevents crashes
+       when fetching a multibyte character consumes more bytes than
+       CHAR_BYTES returns, due to unification of CJK characters in
+       string_char.  (Bug#11073)
+
 2012-03-23  Troels Nielsen  <address@hidden>  (tiny change)
 
        * process.c (wait_reading_process_output): Handle pty disconnect

=== modified file 'src/bidi.c'
--- a/src/bidi.c        2012-01-11 06:53:12 +0000
+++ b/src/bidi.c        2012-03-23 12:32:23 +0000
@@ -932,6 +932,7 @@
   EMACS_INT endpos
     = (string->s || STRINGP (string->lstring)) ? string->schars : ZV;
   struct text_pos pos;
+  int len;
 
   /* If we got past the last known position of display string, compute
      the position of the next one.  That position could be at CHARPOS.  */
@@ -1003,7 +1004,6 @@
     normal_char:
       if (string->s)
        {
-         int len;
 
          if (!string->unibyte)
            {
@@ -1018,8 +1018,6 @@
        }
       else if (STRINGP (string->lstring))
        {
-         int len;
-
          if (!string->unibyte)
            {
              ch = STRING_CHAR_AND_LENGTH (SDATA (string->lstring) + bytepos,
@@ -1034,8 +1032,8 @@
        }
       else
        {
-         ch = FETCH_MULTIBYTE_CHAR (bytepos);
-         *ch_len = CHAR_BYTES (ch);
+         ch = STRING_CHAR_AND_LENGTH (BYTE_POS_ADDR (bytepos), len);
+         *ch_len = len;
        }
       *nchars = 1;
     }


reply via email to

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