[Cbc] CbcSolver.cpp:5558, Valgrind invalid read if numberOfColumns = 0

John Forrest john.forrest at fastercoin.com
Thu Jan 14 07:34:42 EST 2016


Christian,

Thanks for your correct analysis of the situation.

As you surmise it is because the problem is preprocessed to a null problem.

I have changed line to -

     // allow for empty problem
     n = (n) ? originalColumns[n-1] + 1 : 0;

which should fix it.

John Forrest

On 12/01/16 14:25, Christian Troost wrote:
> Dear all,
>
> we have an application that solves many MIPs one after the other using
> Cbc. If I run our application through valgrind, it spots an access
> violation (an invalid read) at CbcSolver.cpp, line 5558 when solving a
> particular MIP.
>
> 5557:    int n = CoinMin(truncateColumns,numberColumns);
> 5558:    n = originalColumns[n-1] + 1;
>
> As I could verify through debugging this is caused by numberColumns
> being zero at that particular point (truncateColumns is at
> COIN_INT_MAX). Since n is used to determine the size of a dynamic array
> two lines below,
>
> 5560: int * newColumn = new int[n];
>
> this can become pretty fatal if the memory location read contains a very
> high value. (At least while running through valgrind it ran out of
> memory at least once.)
>
> I do not understand the surrounding code context well enough to
> understand what caused numberColumns to be zero. (The particular MIP
> might be a rather overconstrained problem, with not much space to chose,
> since it is largely constrained by a previous choice. So maybe all
> columns got pruned and there is no integer left?)
> But I think Cbc should somehow handle this case of numberColumns == 0,
> either by making sure it can't happen or spitting out an error message,
> so it does not go unnoticed...
>
> I would be glad if you could look into a solution for that (or give me a
> hint, how to spot MIPs that might cause these problems before feeding
> them into CbcMain1).
>
> Thanks,
>
> Christian
>   
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc
>
>



More information about the Cbc mailing list