Mercurial > hg > octave-nkf
comparison libinterp/corefcn/variables.cc @ 19055:a0fd65914811
Fix segfault in exist() when checking faulty mex/oct files (bug #36067).
* variables.cc (symbol_exist): Wrap symbol table lookup in try/catch block.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 26 Jun 2014 09:33:38 -0700 |
parents | c677d9bd6bac |
children | d3276190e551 |
comparison
equal
deleted
inserted
replaced
19054:c677d9bd6bac | 19055:a0fd65914811 |
---|---|
416 | 416 |
417 octave_value val; | 417 octave_value val; |
418 | 418 |
419 if (search_any || search_builtin) | 419 if (search_any || search_builtin) |
420 { | 420 { |
421 val = safe_symbol_lookup (name); | 421 // Require a try block because symbol_lookup will attempt unsafe load |
422 // of .oct/.mex file. | |
423 try | |
424 { val = safe_symbol_lookup (name); } | |
425 catch (octave_execution_exception) | |
426 { } | |
422 | 427 |
423 if (val.is_defined () && val.is_builtin_function ()) | 428 if (val.is_defined () && val.is_builtin_function ()) |
424 return 5; | 429 return 5; |
425 | 430 |
426 if (search_builtin) | 431 if (search_builtin) |
460 if (search_any || search_file) | 465 if (search_any || search_file) |
461 { | 466 { |
462 if (fs.is_dir ()) | 467 if (fs.is_dir ()) |
463 return 7; | 468 return 7; |
464 | 469 |
465 size_t len = file_name.length (); | 470 len = file_name.length (); |
466 | 471 |
467 if (len > 4 && (file_name.substr (len-4) == ".oct" | 472 if (len > 4 && (file_name.substr (len-4) == ".oct" |
468 || file_name.substr (len-4) == ".mex")) | 473 || file_name.substr (len-4) == ".mex")) |
469 return 3; | 474 return 3; |
470 else | 475 else |