[macruby-changes] [4821] MacRuby/trunk/compiler.cpp

source_changes at macosforge.org source_changes at macosforge.org
Mon Oct 25 14:03:19 PDT 2010


Revision: 4821
          http://trac.macosforge.org/projects/ruby/changeset/4821
Author:   lsansonetti at apple.com
Date:     2010-10-25 14:03:17 -0700 (Mon, 25 Oct 2010)
Log Message:
-----------
when compiling a bitfield type, raise an exception in case the type string is invalid except of crashing the process (as we might be calling from Pointer.new)

Modified Paths:
--------------
    MacRuby/trunk/compiler.cpp

Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp	2010-10-25 01:14:30 UTC (rev 4820)
+++ MacRuby/trunk/compiler.cpp	2010-10-25 21:03:17 UTC (rev 4821)
@@ -5808,7 +5808,10 @@
 	    {
 		// Syntax is `b3' for `unsigned foo:3'. 
 		const long size = atol(type + 1);
-		assert(size > 0);
+		if (size <= 0) {
+		    rb_raise(rb_eTypeError, "invalid bitfield type: %s",
+			    type);	
+		}
 		return ArrayType::get(BitTy, size);
 	    }
 	    break;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101025/6e6e7e65/attachment.html>


More information about the macruby-changes mailing list