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

Christian Troost christian.troost at uni-hohenheim.de
Tue Jan 12 09:25:16 EST 2016


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
 



More information about the Cbc mailing list