[svn:parrot] r44872 - trunk/src/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Thu Mar 11 09:43:19 UTC 2010
Author: chromatic
Date: Thu Mar 11 09:43:18 2010
New Revision: 44872
URL: https://trac.parrot.org/parrot/changeset/44872
Log:
[PMC] Made FSA throw an exception when initialized with a negative integer.
The text and type of this exception can change; this is a suggestion that
prevents weird memory panics for now anyhow.
Modified:
trunk/src/pmc/fixedstringarray.pmc
Modified: trunk/src/pmc/fixedstringarray.pmc
==============================================================================
--- trunk/src/pmc/fixedstringarray.pmc Thu Mar 11 09:42:14 2010 (r44871)
+++ trunk/src/pmc/fixedstringarray.pmc Thu Mar 11 09:43:18 2010 (r44872)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -54,8 +54,11 @@
*/
VTABLE void init_int(INTVAL size) {
+ if (size < 0)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
+ "Cannot instantiate PMC with negative size %d", size );
SET_ATTR_size(INTERP, SELF, size);
- SET_ATTR_str_array(INTERP, SELF, mem_gc_allocate_n_zeroed_typed(INTERP, size, STRING*));
+ SET_ATTR_str_array(INTERP, SELF, mem_gc_allocate_n_zeroed_typed(INTERP, size, STRING *));
PObj_custom_mark_destroy_SETALL(SELF);
}
More information about the parrot-commits
mailing list