[Osi] Two issues in OsiCpxSolverInterface

Christian Troost christian.troost at uni-hohenheim.de
Fri Feb 12 10:39:41 EST 2016


Dear OsiCpx-Team,

I am currently testing the OsiCpxSolverInterface for our application.

I stumbled over two issues that are probably bugs in the code:

1) In OsiCpxSolverInterface::getRowActivity() the rowact_ array is never
populated and remains unititialized if
        if( probtypemip_ )
	AND  #if CPX_VERSION >= 1100
	AND  if( solntype != CPX_NO_SOLN )

2) In OsiCpxSolverInterface::reset():

OsiCpxSolverInterface calls parent OsiSolverInterface::setInitialData(),

which does the following to the message handler:

  if (defaultHandler_) {
    delete handler_;
    handler_ = NULL;
  }
  defaultHandler_=true;

Now, what if a user passes in a message handler?
According to the headers it is the users' responsibility to deallocate
the message handler. So, assume the following sequence:

A user allocates a message handler in his application
The user passes in this message handler (this will set defaultHandler_=
false) to OsiCpxSolverInterface.
After some time, the user calls ->reset and deallocates the message
handler in his application

Since defaultHandler_ was false, handler_ has not been set to NULL in
reset, but rather still points to the now deallocated memory.

If the user now reuses the SolverInterface for the next problem, without
passing in a messageHandler object the program may segfault on the first
use of the message handler

May not happen to often, but I had a problem and this seemed to be the
reason ...


Best,
Christian


More information about the Osi mailing list