X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftab.c;h=862028a8c5ab56959896e8b9cb8c9deb1f9c1c65;hb=18febf84744dc7ab4248542c2f88d91c01ef3fa1;hp=8672bd76be8378bbef60864b55d3de9a55684f09;hpb=63b39c9b76b2db4c9ac79050f256af8207802b7f;p=pspp diff --git a/src/tab.c b/src/tab.c index 8672bd76be..862028a8c5 100644 --- a/src/tab.c +++ b/src/tab.c @@ -115,6 +115,7 @@ tab_destroy (struct tab_table *t) { assert (t != NULL); pool_destroy (t->container); + t=0; } /* Sets the width and height of a table, in columns and rows, @@ -611,6 +612,11 @@ tab_float (struct tab_table *table, int c, int r, unsigned char opt, assert (table != NULL && w <= 40); + assert (c >= 0); + assert (c < table->nc); + assert (r >= 0); + assert (r < table->nr); + f.type = FMT_F; f.w = w; f.d = d; @@ -1257,7 +1263,7 @@ struct som_table_class tab_table_class = FIXME: Doesn't use r1? Huh? */ static int -render_strip (int x, int y, int r, int c1, int c2, int r1 unused, int r2) +render_strip (int x, int y, int r, int c1, int c2, int r1 UNUSED, int r2) { int x_origin = x; @@ -1339,8 +1345,7 @@ render_strip (int x, int y, int r, int c1, int c2, int r1 unused, int r2) { j->hit = tab_hit; - if (j->x1 == c / 2 && j->y1 == r / 2 - && j->x2 <= c2 && j->y2 <= r2) + if (j->x1 == c / 2 && j->y1 == r / 2) { struct outp_text text; @@ -1354,15 +1359,15 @@ render_strip (int x, int y, int r, int c1, int c2, int r1 unused, int r2) int c; for (c = j->x1, text.h = -t->wrv[j->x2]; - c < j->x2; c++) - text.h += t->w[c] + t->wrv[c + 1]; + c < j->x2 && c < c2 / 2; c++) + text.h += t->w[c] + t->wrv[c + 1]; } { int r; for (r = j->y1, text.v = -t->hrh[j->y2]; - r < j->y2; r++) + r < j->y2 && r < r2 / 2; r++) text.v += t->h[r] + t->hrh[r + 1]; } d->class->text_draw (d, &text);