changeset 17726:d449f4668b72

Print warning and abort plot if data range > max float (bug #40246) * libinterp/corefcn/gl-render.cc(draw_axes): check x, y, and z max values are smaller than std::numeric_limits<float>::max. If not, issue warning and abort plotting.
author Rik <rik@octave.org>
date Tue, 22 Oct 2013 11:50:13 -0700
parents 3f02bcf2bdcc
children 36d646ead233
files libinterp/corefcn/gl-render.cc
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Fri May 10 13:34:31 2013 +0200
+++ b/libinterp/corefcn/gl-render.cc	Tue Oct 22 11:50:13 2013 -0700
@@ -1392,6 +1392,8 @@
 void
 opengl_renderer::draw_axes (const axes::properties& props)
 {
+  static double floatmax = std::numeric_limits<float>::max ();
+
   double x_min = props.get_x_min ();
   double x_max = props.get_x_max ();
   double y_min = props.get_y_min ();
@@ -1399,6 +1401,12 @@
   double z_min = props.get_z_min ();
   double z_max = props.get_z_max ();
 
+  if (x_max > floatmax || y_max > floatmax || z_max > floatmax)
+  {
+    warning ("gl-render: data limits greater than float capacity");
+    return;
+  }
+
   setup_opengl_transformation (props);
 
   // draw axes object