Author: leo
Date: Thu Aug  4 09:18:40 2005
New Revision: 8809

Modified:
   trunk/encodings/fixed_8.c
   trunk/encodings/utf8.c
Log:
fix off by one assert with string iters - pos may be at end

Modified: trunk/encodings/fixed_8.c
==============================================================================
--- trunk/encodings/fixed_8.c   (original)
+++ trunk/encodings/fixed_8.c   Thu Aug  4 09:18:40 2005
@@ -188,7 +188,7 @@ static void
 fixed8_set_position(Interp *interpreter, String_iter *iter, UINTVAL pos)
 {
     iter->bytepos = iter->charpos = pos;
-    assert(pos < PObj_buflen(iter->str));
+    assert(pos <= PObj_buflen(iter->str));
 }
 
 

Modified: trunk/encodings/utf8.c
==============================================================================
--- trunk/encodings/utf8.c      (original)
+++ trunk/encodings/utf8.c      Thu Aug  4 09:18:40 2005
@@ -278,7 +278,7 @@ utf8_encode_and_advance(Interp *interpre
     new_pos = utf8_encode(pos, c);
     i->bytepos += (new_pos - pos);
     /* XXX possible buffer overrun exception? */
-    assert(i->bytepos < PObj_buflen(s));
+    assert(i->bytepos <= PObj_buflen(s));
     i->charpos++;
 }
 

Reply via email to