summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b296fba)
The barchart was created with more than two variables from
the crosstabs subcommand. I added an assertion and limit
the number of variables to two. This bug resulted in a
regression failure (crash) for test
493: CROSSTABS barchart
on i386 architecture.
see: https://savannah.gnu.org/bugs/?58968
- const struct variable **vars = xcalloc (xt->n_vars, sizeof *vars);
- for (size_t i = 0; i < xt->n_vars; i++)
+ int n_vars = (xt->n_vars > 2 ? 2 : xt->n_vars);
+ const struct variable **vars = xcalloc (n_vars, sizeof *vars);
+ for (size_t i = 0; i < n_vars; i++)
vars[i] = xt->vars[i].var;
vars[i] = xt->vars[i].var;
- chart_item_submit (barchart_create (vars, xt->n_vars, _("Count"),
+ chart_item_submit (barchart_create (vars, n_vars, _("Count"),
false,
xt->entries, xt->n_entries));
free (vars);
false,
xt->entries, xt->n_entries));
free (vars);
int width = var_get_width (var[pidx]);
int width = var_get_width (var[pidx]);
+ assert (n_vars >= 1 && n_vars <= 2);
bar = xzalloc (sizeof *bar);
bar->percent = percent;
bar = xzalloc (sizeof *bar);
bar->percent = percent;