ascii.c (ascii_reserve) Added assertion.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 25 Feb 2012 11:15:03 +0000 (12:15 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 26 Feb 2012 18:32:13 +0000 (19:32 +0100)
Added this assertion to catch a yet-to-be fixed array bounds bug.

src/output/ascii.c

index 1c3e6b8238f8f7f0739310ae64bfea6b5778c3bb..7804ade3f475d9e0cc08fa281be5a2d5ed6677d5 100644 (file)
@@ -749,7 +749,9 @@ find_ascii_pos (struct ascii_line *line, int target_x, struct ascii_pos *c)
 static char *
 ascii_reserve (struct ascii_driver *a, int y, int x0, int x1, int n)
 {
-  struct ascii_line *line = &a->lines[y];
+  struct ascii_line *line;
+  assert (y < a->allocated_lines);
+  line = &a->lines[y];
 
   if (x0 >= line->width)
     {