[Symphony] sym_set_row_type args checking

Konvicka Filip Filip.Konvicka at logis.cz
Fri Aug 29 09:51:09 EDT 2014


Hi,

I've accidentally called sym_set_row_type() with row index equal to the number of rows in the model.  This led to a crash later when Symphony was deallocating the related memory block (I believe this was because I had a specific model size so the out-of-range row index led to corruption of the next heap block).

I believe the code that checks the row index is too permissive - it rejects a negative row index and an index strictly greater than the number of rows, but allows the index to be equal to the number of rows.  Similar functions that alter the RHS etc. have similar checks that should probably be reviewed as well.  Also this is mentioned in the documentation to these functions.

In other words, I would change (I think this is in SYMPHONY/src/Master/master.c):

if (!env->mip || !env->mip->m || index > env->mip->m || index < 0 || !env->mip->rhs){

to

if (!env->mip || !env->mip->m || index >= env->mip->m || index < 0 || !env->mip->rhs){

The condition that tests whether "m" is zero is then not needed (so "!env->mip->m" can be omitted).

Thanks,
Filip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/symphony/attachments/20140829/c4684979/attachment.html>


More information about the Symphony mailing list