[svn:parrot] r40974 - trunk/src/string/charset

NotFound at svn.parrot.org NotFound at svn.parrot.org
Fri Sep 4 19:52:50 UTC 2009


Author: NotFound
Date: Fri Sep  4 19:52:48 2009
New Revision: 40974
URL: https://trac.parrot.org/parrot/changeset/40974

Log:
[string] Dubious fix for an out-of-bounds string access, avoids TT #967 segfaults

Modified:
   trunk/src/string/charset/unicode.c

Modified: trunk/src/string/charset/unicode.c
==============================================================================
--- trunk/src/string/charset/unicode.c	Fri Sep  4 19:27:30 2009	(r40973)
+++ trunk/src/string/charset/unicode.c	Fri Sep  4 19:52:48 2009	(r40974)
@@ -969,6 +969,11 @@
     UINTVAL     end = offset + count;
     int         bit;
 
+    if (pos > source_string->strlen) {
+        /* XXX: Throw in this case? */
+        return offset + count;
+    }
+
     ENCODING_ITER_INIT(interp, source_string, &iter);
 
     if (pos)


More information about the parrot-commits mailing list