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

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

bug#1380: 23.0.60; file content causes CVS emacs to crash


From: Chong Yidong
Subject: bug#1380: 23.0.60; file content causes CVS emacs to crash
Date: Thu, 20 Nov 2008 02:36:31 -0500

> The file content in a file causes Emacs to crash as soon as it's
> opened.  Tested with "emacs -q file".

Looks like the charbuf in the coding structure is overflowing.  The
following rough patch prevents this overflow and the crash, but maybe
there is a deeper bug.  The comments in coding.c:6610 says "We are sure
that the number of data is less than the size of coding->charbuf."  This
bug comes about due to that faile assumption.

Handa-san, what do you think?

*** trunk/src/coding.c.~1.394.~ 2008-10-24 00:06:43.000000000 -0400
--- trunk/src/coding.c  2008-11-20 02:29:02.000000000 -0500
***************
*** 6617,6622 ****
--- 6617,6633 ----
  
              if (c & 0x80)
                c = BYTE8_TO_CHAR (c);
+ 
+             if (coding->charbuf_used >= coding->charbuf_size)
+               {
+                 int *old_charbuf = coding->charbuf;
+ 
+                 coding->charbuf_size *= 2;
+                 coding->charbuf = (int *) alloca (sizeof (int)
+                                                   * coding->charbuf_size);
+                 bcopy (old_charbuf, coding->charbuf, coding->charbuf_size);
+               }
+ 
              coding->charbuf[coding->charbuf_used++] = c;
            }
          produce_chars (coding, Qnil, 1);






reply via email to

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