[svn:parrot] r46802 - trunk/src/string

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed May 19 19:29:20 UTC 2010


Author: NotFound
Date: Wed May 19 19:29:19 2010
New Revision: 46802
URL: https://trac.parrot.org/parrot/changeset/46802

Log:
fix again parsing of \xHH in Parrot_str_unescape_string and a hard tab

Modified:
   trunk/src/string/api.c

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Wed May 19 18:39:32 2010	(r46801)
+++ trunk/src/string/api.c	Wed May 19 19:29:19 2010	(r46802)
@@ -2546,7 +2546,7 @@
 Parrot_str_unescape_string(PARROT_INTERP, ARGIN(const STRING *src),
         ARGIN(const CHARSET *charset),
         ARGIN(const ENCODING *encoding),
-	UINTVAL flags)
+        UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_str_unescape_string)
 
@@ -2614,13 +2614,18 @@
                     }
                     else {
                         /* \xhh 1..2 hex digits */
-                        for (digcount = 0; digcount < 2; ++digcount) {
+                        pending = 1;
+                        for (digcount = 0; digcount < 2; ) {
                             if (!isxdigit(c))
                                 break;
                             digbuf[digcount] = c;
+                            ++digcount;
+                            if (itersrc.bytepos >= srclen) {
+                                pending = 0;
+                                break;
+                            }
                             c = itersrc.get_and_advance(interp, &itersrc);
                         }
-                        pending = digcount < 2;
                     }
                     if (digcount == 0)
                         throw_illegal_escape(interp);


More information about the parrot-commits mailing list