changeset 11560:05b5bcdb09c8

validate opts in lookup
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 17 Jan 2011 22:19:29 +0100
parents 26a6435857bc
children 1140bd9f9b21
files src/ChangeLog src/DLD-FUNCTIONS/lookup.cc
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Jan 17 14:33:38 2011 -0500
+++ b/src/ChangeLog	Mon Jan 17 22:19:29 2011 +0100
@@ -1,3 +1,7 @@
+2011-01-17  Jaroslav Hajek  <highegg@gmail.com>
+
+	* DLD-FUNCTION/lookup.cc (Flookup): Validate option string.
+
 2011-01-17  John W. Eaton  <jwe@octave.org>
 
 	* ov-usr-fcn.cc (octave_user_function::bind_automatic_vars):
--- a/src/DLD-FUNCTIONS/lookup.cc	Mon Jan 17 14:33:38 2011 -0500
+++ b/src/DLD-FUNCTIONS/lookup.cc	Mon Jan 17 22:19:29 2011 +0100
@@ -264,6 +264,12 @@
       right_inf = contains_char (opt, 'r');
       match_idx = contains_char (opt, 'm');
       match_bool = contains_char (opt, 'b');
+      if (opt.find_first_not_of ("lrmb") != std::string::npos)
+        {
+          error ("lookup: unrecognized option: %c",
+                 opt[opt.find_first_not_of ("lrmb")]);
+          return retval;
+        }
     }
 
   if ((match_idx || match_bool) && (left_inf || right_inf))