changeset 6856:b39ecdddd77b

[project @ 2007-09-01 00:49:18 by dbateman]
author dbateman
date Sat, 01 Sep 2007 00:49:19 +0000
parents a052825889a0
children 5cc9caab1a31
files src/ChangeLog src/ls-mat-ascii.cc
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Sep 01 00:08:16 2007 +0000
+++ b/src/ChangeLog	Sat Sep 01 00:49:19 2007 +0000
@@ -1,5 +1,8 @@
 2007-08-31  Michael Goffioul <michael.goffioul@gmail.com>
 
+	* 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.
 
--- a/src/ls-mat-ascii.cc	Sat Sep 01 00:08:16 2007 +0000
+++ b/src/ls-mat-ascii.cc	Sat Sep 01 00:49:19 2007 +0000
@@ -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,