Segfaults all around on sample Poseidon MkVI XML log

Dirk Hohndel dirk at hohndel.org
Sat Nov 22 06:52:50 PST 2014


On Sat, Nov 22, 2014 at 03:02:48PM +0100, Giuseppe Bilotta wrote:
> Hello,
> 
> so, I tried opening dives/Poseidon_MkVILog.xml and Subsurface crashed.
> I've been tracking the issue since this morning, and not being
> particularly familiar with anything but some of the UI log, I'm not
> even sure I'm chasing the right bug(s).
> 
> My understanding is presently the following:
> 
> * the given sample log is for a CCR dive;
> * CCR dives were recently changed to default to the DILUENT cyl, plus
> extra stuff done on the OXYGEN cyl;
> * the given sample log has two cylinders, of unspecified type, that
> means everything defaults to OC_GAS;
> * every single piece of code that expectes a DILUENT + OXYGEN cylinder
> pair breaks in all possible ways (but mostly by getting -1 indices
> when the OXYGEN cylinder isn't found, and thus overwriting random
> memory all around).
> 
> A quick fix in this case is to obviously change the types of the
> cylinders to DILUENT and OXYGEN as appropriate, but (1) I'm not sure
> this can be done robustly in more generally borked cases and (2) most
> of the code that uses get_cylinder_{idx_by_,}use doesn't check for -1
> and is thus very fragile.
> 
> Suggestions on how to operate the patient, doc?

Both suggestions are correct.

The XML file should't even be there - I'm going to remove it (unless
Willem / Robert disagree)
Open the .txt file. Saving that as XML should then give you a correct XML
file.

But the more important suggestions is that yes, we should check the
accesses to the cylinders and do something sane if there is no cylinder
for that specific use. I haven't looked at the code (I'm in a bit of a
rush this morning), but most likely this means that we need to change the
way we use these functions...

/D


More information about the subsurface mailing list