[svn:parrot] r49001 - trunk/src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Sep 14 18:00:28 UTC 2010


Author: NotFound
Date: Tue Sep 14 18:00:28 2010
New Revision: 49001
URL: https://trac.parrot.org/parrot/changeset/49001

Log:
reintroduce ByteBuffer string result validation deleted in r48889, the catching tests were passing for wrong reasons

Modified:
   trunk/src/pmc/bytebuffer.pmc

Modified: trunk/src/pmc/bytebuffer.pmc
==============================================================================
--- trunk/src/pmc/bytebuffer.pmc	Tue Sep 14 16:55:34 2010	(r49000)
+++ trunk/src/pmc/bytebuffer.pmc	Tue Sep 14 18:00:28 2010	(r49001)
@@ -393,7 +393,15 @@
     if (encoding == NULL)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_ENCODING,
                 "Invalid encoding");
-    return Parrot_str_new_init(interp, (const char *)content, size, encoding, 0);
+    else {
+        STRING * const result = Parrot_str_new_init(interp,
+                (const char *)content, size, encoding, 0);
+        if (!STRING_validate(interp, result))
+            Parrot_ex_throw_from_c_args(interp, NULL,
+                    EXCEPTION_INVALID_STRING_REPRESENTATION,
+                    "Invalid buffer content");
+        return result;
+    }
 }
 
 /*


More information about the parrot-commits mailing list