[Cbc] callCbc1 - Problem in callCbc1

Christian Troost christian.troost at uni-hohenheim.de
Tue Feb 24 08:35:41 EST 2015


Dear CBC Team,

we have an application that uses CBC to solve many mixed integer
problems one after the other. When searching for an ominous segmentation
fault I ran the application through valgrind memcheck, which reported
various invalid reads and an occasional invalid write in callCbc1 (the
innermost of the wrappers of this name).

Upon inspecting the function I found the following problem:

If I understood the logic of the code correctly, then the line

        bool blank = input[0] == '0';

should rather read

        bool blank = input[0] == ' ';

because you are looking for a potential blank at the beginning of the
argument string, not for a literal 0.

Am I right with this assumption?

At least, when I corrected accordingly, the invalid memory access
disappeared except for occasional invalid reads at

length = strlen(input)

This however seems related to the valgrind problem discussed on
https://bugzilla.redhat.com/show_bug.cgi?id=678518 and does disappear
when running valgrind with 

--partial-loads-ok=yes


(Still I wonder whether an empty/NULL input2 wouldn't cause a problem
here, because input is not checked before being used in strlen.) 

Best,

Christian




More information about the Cbc mailing list