# HG changeset patch # User Rik # Date 1403800418 25200 # Node ID a0fd659148115ec9734bc789de8aadc9298759c1 # Parent c677d9bd6bacfc716b798d5fd4770955e4e2c833 Fix segfault in exist() when checking faulty mex/oct files (bug #36067). * variables.cc (symbol_exist): Wrap symbol table lookup in try/catch block. diff -r c677d9bd6bac -r a0fd65914811 libinterp/corefcn/variables.cc --- a/libinterp/corefcn/variables.cc Thu Jun 26 09:02:01 2014 -0700 +++ b/libinterp/corefcn/variables.cc Thu Jun 26 09:33:38 2014 -0700 @@ -418,7 +418,12 @@ if (search_any || search_builtin) { - val = safe_symbol_lookup (name); + // Require a try block because symbol_lookup will attempt unsafe load + // of .oct/.mex file. + try + { val = safe_symbol_lookup (name); } + catch (octave_execution_exception) + { } if (val.is_defined () && val.is_builtin_function ()) return 5; @@ -462,7 +467,7 @@ if (fs.is_dir ()) return 7; - size_t len = file_name.length (); + len = file_name.length (); if (len > 4 && (file_name.substr (len-4) == ".oct" || file_name.substr (len-4) == ".mex"))