]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #11288 with overrunning array limits.
authorEli Zaretskii <eliz@gnu.org>
Fri, 20 Apr 2012 14:08:55 +0000 (17:08 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 20 Apr 2012 14:08:55 +0000 (17:08 +0300)
 src/dispnew.c (swap_glyph_pointers, copy_row_except_pointers): Don't
 overrun array limits of glyph row's used[] array.

src/ChangeLog
src/dispnew.c

index 18b6ce1ad64865a2e5fceb866fd704b54840b6e1..c232420d0b1526dc27f1ab564d7fb55444b55564 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (swap_glyph_pointers, copy_row_except_pointers): Don't
+       overrun array limits of glyph row's used[] array.  (Bug#11288)
+
 2012-04-20  Chong Yidong  <cyd@gnu.org>
 
        * process.c (wait_reading_process_output): If EIO occurs on a pty,
index 02d6de53bbf4568acdae50a443f4948cf2101cd5..b313852efe286967f6ae8946bbb41945a60b423d 100644 (file)
@@ -1085,12 +1085,16 @@ swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b)
   for (i = 0; i < LAST_AREA + 1; ++i)
     {
       struct glyph *temp = a->glyphs[i];
-      short used_tem = a->used[i];
 
       a->glyphs[i] = b->glyphs[i];
       b->glyphs[i] = temp;
-      a->used[i] = b->used[i];
-      b->used[i] = used_tem;
+      if (i < LAST_AREA)
+       {
+         short used_tem = a->used[i];
+
+         a->used[i] = b->used[i];
+         b->used[i] = used_tem;
+       }
     }
   a->hash = b->hash;
   b->hash = hash_tem;
@@ -1105,7 +1109,7 @@ static inline void
 copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
 {
   struct glyph *pointers[1 + LAST_AREA];
-  short used[1 + LAST_AREA];
+  short used[LAST_AREA];
   unsigned hashval;
 
   /* Save glyph pointers of TO.  */