[cxx-abi-dev] Run-time array checking

Mike Herrick mjh at edg.com
Thu Sep 13 14:00:32 UTC 2012


On Sep 13, 2012, at 9:00 AM, Mike Herrick wrote:

> Okay, if there aren't any other objections/ideas, I'll come up with a patch.

Here's a proposed patch (against the current gh-pages branch at github):

diff --git a/abi.html b/abi.html
index fe5e72c..10f4ca5 100644
--- a/abi.html
+++ b/abi.html
@@ -3329,6 +3329,12 @@ not be called.</p>
 
 <p>Neither <code>alloc</code> nor <code>dealloc</code> may be
 <code>NULL</code>.</p>
+
+<p>If the computed size of the allocated array object (including
+space for a cookie, if specified) would exceed the
+implementation-defined limit, <code>std::bad_array_new_length</code>
+is thrown.</p>
+
 </dd>
 
 <dt><code><pre>
@@ -3347,6 +3353,16 @@ function takes both the object address and its size.
 </dd>
 
 <dt><code><pre>
+extern "C" void __cxa_throw_bad_array_new_length (void);
+</pre></code></dt>
+<dd>
+Unconditionally throws <code>std::bad_array_new_length</code>.
+May be invoked by the compiler when the number of array elements
+expression of a <code>new[]</code> operation violates the requirements
+of the C++ standard.
+</dd>
+
+<dt><code><pre>
 extern "C" void __cxa_vec_ctor (
            void *array_address,
            size_t element_count,

Mike.




More information about the cxx-abi-dev mailing list