Revision: 4514 http://trac.macosforge.org/projects/ruby/changeset/4514 Author: lsansonetti@apple.com Date: 2010-09-13 21:40:54 -0700 (Mon, 13 Sep 2010) Log Message: ----------- let's complain when trying to resize negative capacities like MRI does Modified Paths: -------------- MacRuby/trunk/string.c Modified: MacRuby/trunk/string.c =================================================================== --- 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));
participants (1)
-
source_changes@macosforge.org