[svn:parrot] r46969 - trunk/compilers/imcc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Mon May 24 17:22:44 UTC 2010


Author: NotFound
Date: Mon May 24 17:22:43 2010
New Revision: 46969
URL: https://trac.parrot.org/parrot/changeset/46969

Log:
[imcc] check unknown charset/encoding

Modified:
   trunk/compilers/imcc/pbc.c

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	Mon May 24 17:06:29 2010	(r46968)
+++ trunk/compilers/imcc/pbc.c	Mon May 24 17:22:43 2010	(r46969)
@@ -913,13 +913,25 @@
             charset_name[p- p2 - 2] = '\0';
             /*fprintf(stderr, "%s:%s\n", charset_name, encoding_name);*/
             s_charset = Parrot_find_charset(interp, charset_name);
+            if (s_charset == NULL)
+                Parrot_ex_throw_from_c_args(interp, NULL,
+                        EXCEPTION_INVALID_STRING_REPRESENTATION,
+                        "Unknown charset '%s'", charset_name);
             s_encoding = Parrot_find_encoding(interp, encoding_name);
+            if (s_encoding == NULL)
+                Parrot_ex_throw_from_c_args(interp, NULL,
+                        EXCEPTION_INVALID_STRING_REPRESENTATION,
+                        "Unknown encoding '%s'", encoding_name);
         }
         else {
             strncpy(charset_name, buf, p - buf - 1);
             charset_name[p - buf - 1] = '\0';
             /*fprintf(stderr, "%s\n", charset_name);*/
             s_charset = Parrot_find_charset(interp, charset_name);
+            if (s_charset == NULL)
+                Parrot_ex_throw_from_c_args(interp, NULL,
+                        EXCEPTION_INVALID_STRING_REPRESENTATION,
+                        "Unknown charset '%s'", charset_name);
         }
         if (strcmp(charset_name, "unicode") == 0)
             src_encoding = Parrot_utf8_encoding_ptr;


More information about the parrot-commits mailing list