Mercurial > hg > octave-nkf
changeset 20416:3c8260fd0837
Validate second option to exist () (bug #42618).
* variables.cc (symbol_exist): Emit an error if the type argument is not one of
the accepted values.
* variables.cc (Fexist): Add BIST test to check input validation.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 19 May 2015 13:49:21 -0700 |
parents | 70e8801a56f7 |
children | abf85f8cbd6c |
files | libinterp/corefcn/variables.cc |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc +++ b/libinterp/corefcn/variables.cc @@ -395,6 +395,14 @@ bool search_dir = type == "dir"; bool search_file = type == "file"; bool search_builtin = type == "builtin"; + bool search_class = type == "class"; + + if (! (search_any || search_var || search_dir || search_file || + search_builtin || search_class)) + { + error ("exist: unrecognized type argument \"%s\"", type.c_str ()); + return 0; + } if (search_any || search_var) { @@ -682,6 +690,7 @@ %!warning <"class" type argument is not implemented> exist ("a", "class"); %!error <TYPE must be a string> exist ("a", 1) %!error <NAME must be a string> exist (1) +%!error <unrecognized type argument "foobar"> exist ("a", "foobar") */