Re: [eigen] Possible undefined behavior in insert() in SparseMatrix

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Thanks, bug fixed.

On Thu, May 7, 2009 at 2:47 PM, Jens Mueller <jens.k.mueller@xxxxxx> wrote:
> Hi,
>
> I justed checked the new insert() method for the SparseMatrix. There
> seems to be a problem, if the actual size is 0. So assuming you created
> a new sparse matrix and ran setZero() but no reserve(). And then you
> start inserting. In that case line 251 in SparseMatrix results in a nan
> (due to division by zero). And the following std::max and std::min
> operations have undefined behavior when passing a nan. In my case I get
> a nan as value for reallocRatio. And this may result in
> CompressedStorage's resize to allocate really much memory.
> For me I even get a std::bad_alloc, if my Scalar type is an unsigned
> char (checked attached code). For some reason I don't get it for int.
> This is strange to me. But another issue I don not understand yet.
>
> Regards,
> Jens
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/