[svn:parrot] r49119 - branches/gc_massacre/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Fri Sep 17 23:51:01 UTC 2010


Author: bacek
Date: Fri Sep 17 23:51:01 2010
New Revision: 49119
URL: https://trac.parrot.org/parrot/changeset/49119

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

Modified:
   branches/gc_massacre/src/pmc/bytebuffer.pmc

Modified: branches/gc_massacre/src/pmc/bytebuffer.pmc
==============================================================================
--- branches/gc_massacre/src/pmc/bytebuffer.pmc	Fri Sep 17 23:50:46 2010	(r49118)
+++ branches/gc_massacre/src/pmc/bytebuffer.pmc	Fri Sep 17 23:51:01 2010	(r49119)
@@ -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