Commit a3ed914b authored by Tatsuya Kinoshita's avatar Tatsuya Kinoshita

Prevent negative array index in set_integered_width()

Bug-Debian: https://github.com/tats/w3m/issues/70
parent a6ddc331
...@@ -960,7 +960,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth) ...@@ -960,7 +960,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
for (step = 0; step < 2; step++) { for (step = 0; step < 2; step++) {
for (i = 0; i <= t->maxcol; i += n) { for (i = 0; i <= t->maxcol; i += n) {
int nn; int nn;
char *idx; short *idx;
double nsum; double nsum;
if (sum < 0.5) if (sum < 0.5)
return; return;
...@@ -981,7 +981,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth) ...@@ -981,7 +981,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
(double)rulewidth - mod[ii] > 0.5) (double)rulewidth - mod[ii] > 0.5)
fixed[ii] = 1; fixed[ii] = 1;
} }
idx = NewAtom_N(char, n); idx = NewAtom_N(short, n);
for (k = 0; k < cell->maxcell; k++) { for (k = 0; k < cell->maxcell; k++) {
int kk, w, width, m; int kk, w, width, m;
j = cell->index[k]; j = cell->index[k];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment