diff --git a/contrib/less/NEWS b/contrib/less/NEWS index f251a1e71ef6..0154225de76c 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -13,7 +13,7 @@ ====================================================================== - Major changes between "less" versions 406 and 408 + Major changes between "less" versions 406 and 409 * Support CSI escape sequences, like SGR escape sequences. @@ -23,6 +23,8 @@ * Fix configure bug on systems which don't support langinfo.h. +* Fix crash when searching text containing certain invalid UTF-8 sequences. + ====================================================================== Major changes between "less" versions 394 and 406 @@ -695,3 +697,4 @@ + diff --git a/contrib/less/README b/contrib/less/README index ace7bf090ed1..73329d63b87c 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -1,7 +1,7 @@ - Less, version 408 + Less, version 409 - This is the distribution of less, version 408, released 01 Oct 2007. + This is the distribution of less, version 409, released 12 Oct 2007. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or diff --git a/contrib/less/charset.c b/contrib/less/charset.c index 628218d50f24..37d344de69f4 100644 --- a/contrib/less/charset.c +++ b/contrib/less/charset.c @@ -668,6 +668,7 @@ step_char(pp, dir, limit) char *limit; { LWCHAR ch; + int len; char *p = *pp; if (!utf_mode) @@ -679,14 +680,15 @@ step_char(pp, dir, limit) ch = (LWCHAR) ((p > limit) ? *--p : 0); } else if (dir > 0) { - if (p + utf_len(*p) > limit) + len = utf_len(*p); + if (p + len > limit) + { ch = 0; - else + p = limit; + } else { ch = get_wchar(p); - p++; - while (IS_UTF8_TRAIL(*p)) - p++; + p += len; } } else { diff --git a/contrib/less/less.man b/contrib/less/less.man index 217a321ccccc..773c7b9ccb51 100644 --- a/contrib/less/less.man +++ b/contrib/less/less.man @@ -1544,4 +1544,4 @@ LESS(1) LESS(1) - Version 408: 01 Oct 2007 LESS(1) + Version 409: 12 Oct 2007 LESS(1) diff --git a/contrib/less/less.nro b/contrib/less/less.nro index 5399e83a713c..483e194449c6 100644 --- a/contrib/less/less.nro +++ b/contrib/less/less.nro @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 408: 01 Oct 2007" +.TH LESS 1 "Version 409: 12 Oct 2007" .SH NAME less \- opposite of more .SH SYNOPSIS diff --git a/contrib/less/lessecho.man b/contrib/less/lessecho.man index 2bf8c9ec0af9..588f70aaaa0d 100644 --- a/contrib/less/lessecho.man +++ b/contrib/less/lessecho.man @@ -46,4 +46,4 @@ LESSECHO(1) LESSECHO(1) - Version 408: 01 Oct 2007 LESSECHO(1) + Version 409: 12 Oct 2007 LESSECHO(1) diff --git a/contrib/less/lessecho.nro b/contrib/less/lessecho.nro index 06c39361791f..d9dd628cb041 100644 --- a/contrib/less/lessecho.nro +++ b/contrib/less/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 408: 01 Oct 2007" +.TH LESSECHO 1 "Version 409: 12 Oct 2007" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS diff --git a/contrib/less/lesskey.man b/contrib/less/lesskey.man index b4d4e2fc9cf4..f951ea4e5c5c 100644 --- a/contrib/less/lesskey.man +++ b/contrib/less/lesskey.man @@ -357,4 +357,4 @@ LESSKEY(1) LESSKEY(1) - Version 408: 01 Oct 2007 LESSKEY(1) + Version 409: 12 Oct 2007 LESSKEY(1) diff --git a/contrib/less/lesskey.nro b/contrib/less/lesskey.nro index a49a1c07a8cb..afc358694300 100644 --- a/contrib/less/lesskey.nro +++ b/contrib/less/lesskey.nro @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 408: 01 Oct 2007" +.TH LESSKEY 1 "Version 409: 12 Oct 2007" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS diff --git a/contrib/less/version.c b/contrib/less/version.c index a4d7ea757cb6..1fce12e560b1 100644 --- a/contrib/less/version.c +++ b/contrib/less/version.c @@ -695,6 +695,7 @@ v405 6/17/07 Fix display bug when using -w option. v406 6/17/07 Fix secure build. v407 8/16/07 Fix bugs; support CSI chars. v408 10/1/07 Fix bug in -i with non-ASCII chars. +v409 10/12/07 Fix crash when viewing text with invalid UTF-8 sequences. */ -char version[] = "408"; +char version[] = "409";