changeset 90671:140d663891af

(simple_search): Fix sync with HEAD.
author Kenichi Handa <handa@m17n.org>
date Wed, 22 Nov 2006 01:57:16 +0000
parents a48ba67a019c
children 68b137522376
files src/search.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Wed Nov 22 01:19:14 2006 +0000
+++ b/src/search.c	Wed Nov 22 01:57:16 2006 +0000
@@ -1397,7 +1397,7 @@
 	    int this_len = len;
 	    int this_len_byte = len_byte;
 	    unsigned char *p = pat;
-	    if (pos + len > lim)
+	    if (pos + len > lim || pos_byte + len_byte > lim_byte)
 	      goto stop;
 
 	    while (this_len > 0)
@@ -1481,14 +1481,13 @@
 	  {
 	    /* Try matching at position POS.  */
 	    int this_pos = pos - len;
-	    int this_pos_byte;
+	    int this_pos_byte = CHAR_TO_BYTE (this_pos);
 	    int this_len = len;
 	    int this_len_byte = len_byte;
 	    unsigned char *p = pat;
 
-	    if (pos - len < lim)
+	    if (this_pos < lim || this_pos_byte < lim_byte)
 	      goto stop;
-	    this_pos_byte = CHAR_TO_BYTE (this_pos);
 	    match_byte = pos_byte - this_pos_byte;
 
 	    while (this_len > 0)
@@ -1534,7 +1533,7 @@
 	    int this_len = len;
 	    unsigned char *p = pat;
 
-	    if (this_pos < lim || this_pos_byte < lim_byte)
+	    if (this_pos < lim)
 	      goto stop;
 
 	    while (this_len > 0)