changeset 17727:36d646ead233

Fix segfault when x or y data values are large (bug #39925). * libinterp/corefcn/gl-render.cc(draw_image): Check result of transform calculation. If there are any NaN values, calc has failed and abort drawing image.
author Rik <rik@octave.org>
date Tue, 22 Oct 2013 12:27:31 -0700
parents d449f4668b72
children 38e9dee9c627
files libinterp/corefcn/gl-render.cc
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Tue Oct 22 11:50:13 2013 -0700
+++ b/libinterp/corefcn/gl-render.cc	Tue Oct 22 12:27:31 2013 -0700
@@ -2557,6 +2557,12 @@
   const ColumnVector p0 = xform.transform (x(0), y(0), 0);
   const ColumnVector p1 = xform.transform (x(1), y(1), 0);
 
+  if (xisnan (p0(0)) || xisnan (p0(1)) || xisnan (p1(0)) || xisnan (p1(1)))
+    {
+      warning ("gl-render: image x,y data too large to draw");
+      return;
+    }
+
   // image pixel size in screen pixel units
   float pix_dx, pix_dy;
   // image pixel size in normalized units