# HG changeset patch # User dbateman # Date 1188607759 0 # Node ID b39ecdddd77b81de0133180981db120bdb7ecf62 # Parent a052825889a075a955399922283f9847c211f494 [project @ 2007-09-01 00:49:18 by dbateman] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2007-08-31 Michael Goffioul + * ls-mat-ascii.cc (get_lines_and_columns): Check beg variable for + NPOS to avoid segmentation fault. + * load-path.cc (load_path::do_find_file): Do not assume paths use forward slashes. diff --git a/src/ls-mat-ascii.cc b/src/ls-mat-ascii.cc --- a/src/ls-mat-ascii.cc +++ b/src/ls-mat-ascii.cc @@ -151,7 +151,8 @@ { beg = buf.find_first_not_of (", \t", end); - if (buf[beg] == '\r' && beg == buf.length () - 1) + if (beg == NPOS || (buf[beg] == '\r' && + beg == buf.length () - 1)) { // We had a line with trailing spaces and // ending with a CRLF, so this should look like EOL,