Mercurial > hg > octave-nkf
changeset 14268:61db003b8e47 stable
Avoid segfault on empty load command
* load-save.cc (Fload): Check if filename to be loaded is nonempty
* load-save.m: Add a test to check this
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 27 Jan 2012 14:06:07 -0500 |
parents | 1facbe04b00c |
children | 824e5d362aba |
files | src/load-save.cc test/test_io.m |
diffstat | 2 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -649,7 +649,7 @@ std::string orig_fname = ""; // Function called with Matlab-style ["filename", options] syntax - if (argc > 1 && argv[1].at(0) != '-') + if (argc > 1 && ! argv[1].empty () && argv[1].at(0) != '-') { orig_fname = argv[1]; i++;
--- a/test/test_io.m +++ b/test/test_io.m @@ -227,6 +227,8 @@ %! %! delete matrix.ascii; +%!error <unable to find file> load ("") + %% FIXME: This test is disabled as it writes to stdout and there is no easy %% way to recover output. Need to spawn new octave process and pipe stdout %% somewhere to treat this case.