let's complain when trying to resize negative capacities like MRI does
--- MacRuby/trunk/string.c 2010-09-14 04:40:27 UTC (rev 4513)
+++ MacRuby/trunk/string.c 2010-09-14 04:40:54 UTC (rev 4514)
@@ -700,6 +700,9 @@
static void
str_resize_bytes(rb_str_t *self, long new_capacity)
{
+ if (new_capacity < 0) {
+ rb_raise(rb_eArgError, "negative string size (or size too big)");
+ }
if (self->capacity_in_bytes < new_capacity) {
if (self->data.bytes == NULL) {
GC_WB(&self->data.bytes, xmalloc(new_capacity));