[macruby-changes] [4514] MacRuby/trunk/string.c
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 13 21:40:55 PDT 2010
Revision: 4514
http://trac.macosforge.org/projects/ruby/changeset/4514
Author: lsansonetti at 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));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100913/79d7f1d9/attachment-0001.html>
More information about the macruby-changes
mailing list