diff libinterp/corefcn/data.cc @ 22021:e67ff2b11147

Check that second argument to size () is a scalar (bug #48368). * data.cc (Fsize): Fail if second argument is not a scalar.
author Lachlan Andrew <lachlanbis@gmail.com>
date Sat, 02 Jul 2016 05:11:09 +1000
parents 112b20240c87
children 278fc29b69ca
line wrap: on
line diff
--- a/libinterp/corefcn/data.cc	Fri Jul 01 08:14:50 2016 -0700
+++ b/libinterp/corefcn/data.cc	Sat Jul 02 05:11:09 2016 +1000
@@ -2815,7 +2815,10 @@
     }
   else if (nargin == 2 && nargout < 2)
     {
-      octave_idx_type nd = args(1).xidx_type_value ("size: DIM must be an integer");
+      if (! args(1).is_real_scalar ())
+        error ("size: DIM must be a positive integer");
+
+      octave_idx_type nd = args(1).idx_type_value ();
 
       const dim_vector dv = args(0).dims ();