Mercurial > octave
changeset 25422:156876229e8f
Avoid segfault with textscan (bug #53786).
* oct-stream.cc (textscan::skip_whitespace): Check for length of cell before
getting element.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 02 Jun 2018 18:28:38 +0200 |
parents | c335f94766a7 |
children | 13b1b9a0d9c5 |
files | libinterp/corefcn/oct-stream.cc |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc Sat Jun 02 14:17:49 2018 +0200 +++ b/libinterp/corefcn/oct-stream.cc Sat Jun 02 18:28:38 2018 +0200 @@ -3758,8 +3758,9 @@ std::string tmp (comment_len, '\0'); char *look = is.read (&tmp[0], comment_len-1, pos); // already read first char - if (is && ! strncmp (comment_style(0).string_value ().substr (1) - .c_str (), look, comment_len-1)) + if (is && comment_style.numel () > 0 && + ! strncmp (comment_style(0).string_value ().substr (1).c_str (), + look, comment_len-1)) { found_comment = true;