[svn:parrot] r47491 - branches/gc_massacre/src/string/encoding
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Jun 8 22:56:18 UTC 2010
Author: bacek
Date: Tue Jun 8 22:56:18 2010
New Revision: 47491
URL: https://trac.parrot.org/parrot/changeset/47491
Log:
Fix assert to avoid buffer overrun in next-after-last character.
Modified:
branches/gc_massacre/src/string/encoding/utf8.c
Modified: branches/gc_massacre/src/string/encoding/utf8.c
==============================================================================
--- branches/gc_massacre/src/string/encoding/utf8.c Tue Jun 8 22:54:35 2010 (r47490)
+++ branches/gc_massacre/src/string/encoding/utf8.c Tue Jun 8 22:56:18 2010 (r47491)
@@ -455,9 +455,11 @@
unsigned char * const new_pos = (unsigned char *)utf8_encode(interp, pos, c);
i->bytepos += (new_pos - pos);
- /* XXX possible buffer overrun exception? */
- PARROT_ASSERT(i->bytepos <= Buffer_buflen(s));
++i->charpos;
+ /* XXX possible buffer overrun exception? */
+ /* We are finished or still have some data. Exact match on strlen to assert overrun */
+ PARROT_ASSERT((i->charpos == s->strlen)
+ || (i->bytepos <= Buffer_buflen(s)));
}
/*
More information about the parrot-commits
mailing list