bug fix, iplot(): Buffer overflow

Thanks to Zsolt Makaró for the bug report in
  Buffer overflow detected - ID: 3510521
  http://sourceforge.net/tracker/?func=detail&aid=3510521&group_id=38962&atid=423915
This commit is contained in:
h_vogt 2012-03-24 18:29:36 +01:00
parent 0a2e031cb1
commit b4516b08ca
1 changed files with 10 additions and 1 deletions

View File

@ -654,6 +654,11 @@ iplot(struct plot *pl, int id)
if (!yl)
yl = v->v_name;
}
/* generate a small difference between ymin and ymax
to catch the y=const case */
if (ylims[0] == ylims[1])
ylims[1] += 1e-9;
if (ft_grdb)
fprintf(cp_err,
"iplot: after 5, xlims = %G, %G, ylims = %G, %G\n",
@ -762,6 +767,8 @@ iplot(struct plot *pl, int id)
currentgraph->data.ymin) * YFACTOR;
/* currentgraph->data.ymin +=
(dy - currentgraph->data.ymin) * YFACTOR;*/
/* currentgraph->data.ymin = dy;
currentgraph->data.ymin *= (1 + YFACTOR); */
}
if (currentgraph->data.ymax <
currentgraph->data.ymin)
@ -779,9 +786,11 @@ iplot(struct plot *pl, int id)
/* set the new y hi value */
currentgraph->data.ymax +=
(currentgraph->data.ymax -
currentgraph->data.ymin) * YFACTOR;
currentgraph->data.ymin) * YFACTOR;
/* currentgraph->data.ymax +=
(dy - currentgraph->data.ymax) * YFACTOR;*/
/* currentgraph->data.ymax = dy;
currentgraph->data.ymax *= (1 + YFACTOR); */
}
}
if (changed) {