diff scripts/plot/surfnorm.m @ 10634:60542efcfa2c

Check input arguments for size and type (bug #29861). Prevents segmentation fault with odd inputs.
author Rik <octave@nomad.inbox5.com>
date Sun, 16 May 2010 18:28:59 -0700
parents 95c3e38098bf
children be55736a0783
line wrap: on
line diff
--- a/scripts/plot/surfnorm.m
+++ b/scripts/plot/surfnorm.m
@@ -71,8 +71,12 @@
     ioff = 4;
   endif
 
-  if (nargout == 0)
+  if (!ismatrix (z) || isvector (z) || isscalar (z))
+    error ("surfnorm: z argument must be a matrix");
   endif
+  if (! size_equal (x, y, z))
+    error ("surfnorm: x, y, and z must have the same dimensions");
+  endif 
 
   ## Make life easier, and avoid having to do the extrapolation later, do
   ## a simpler linear extrapolation here. This is approximative, and works