coin-or/CoinUtils

CoinPresolve upgrades --- null pointer issues

LouHafer opened this issue · 0 comments

Folks,

I got to playing around with my old dylp code and stumbled over a couple of upgrades to CoinPresolve that leave a trap for the unwary. Both relate to CoinPresolveDoubleton, with collateral damage in CoinPostsolveMatrix that poses a hazard for anyone using CoinPresolve.

One is pretty straightforward, an unguarded reference to a row status vector in doubleton_action::presolve. CoinPresolve code does not assume a solution, so I don't see a problem with guarding this.

The second issue is more complex. Commit cadd599, 2021-05-28, captures the changes. The trouble lies with the new members CoinPostsolveMatrix::originalRowLower_and originalRowUpper_. These are used unguarded in doubleton_action::postsolve and are initialised ad hoc in code in ClpPresolve::postsolve and OsiPresolve::postsolve. No doc'n. Kind of a trap for the unwary. I'm proposing to guard the code block starting at line 1682 in CoinPresolveDoubleton.cpp (hence not breaking existing code) and adding the necessary vector references as optional parameters to the CoinPostsolveMatrix constructor and to assignPresolveToPostsolve with a word about usage.

Thoughts? If no one objects or wants to propose an alternative strategy, I'll do up a pull request.