Browse Source

bug 578 crash when scale is too short

Warning message if scale and vector length do not match.
Restrict number of points plotted to the smaller of both.
pre-master-46
Holger Vogt 4 years ago
parent
commit
640fa7e17b
  1. 6
      src/frontend/plotting/plotcurv.c

6
src/frontend/plotting/plotcurv.c

@ -135,7 +135,11 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
Then everything is plotted. */ Then everything is plotted. */
bool mono = (currentgraph->plottype != PLOT_RETLIN); bool mono = (currentgraph->plottype != PLOT_RETLIN);
int dir = 0; int dir = 0;
for (i = 0, j = v->v_length; i < j; i++) {
int vlength = v->v_length;
int slength = xs->v_length;
if (slength != vlength)
fprintf(stderr, "Warning: length of vector %s and its scale do not match, plot may be truncated!\n", v->v_name);
for (i = 0, j = min(vlength, slength); i < j; i++) {
dx = isreal(xs) ? xs->v_realdata[i] : dx = isreal(xs) ? xs->v_realdata[i] :
realpart(xs->v_compdata[i]); realpart(xs->v_compdata[i]);
dy = isreal(v) ? v->v_realdata[i] : dy = isreal(v) ? v->v_realdata[i] :

Loading…
Cancel
Save