CSV import crash

Dirk Hohndel dirk at hohndel.org
Thu Jan 29 15:35:18 PST 2015


On Thu, Jan 29, 2015 at 12:44:58PM -0800, Dirk Hohndel wrote:
> On Thu, Jan 29, 2015 at 08:47:30PM +0100, Robert Helling wrote:
> > Hi,
> > 
> > > On 29 Jan 2015, at 20:01, Dirk Hohndel <dirk at hohndel.org <mailto:dirk at hohndel.org>> wrote:
> > > 
> > > And it doesn't crash on my Mac, either.
> > > 
> > > Can you give more data? Which git version of Subsurface? How did you build
> > > it (i.e., which Qt, what tool chain)? Can you reproduce this with the
> > > daily binaries from this morning?
> > 
> > it does crash for me. The last subsurface code on the stack is line 437 of divelogimportdialog.cpp
> > 
> > 			headers.replace(CSVApps[value].time, tr("Sample time"));
> 
> That's not line 437 in master... that's 473
> 
> > I have no idea, what this is but I can tell CSCApps is != NULL, value == 3  and there the assertion
> >     Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::replace", "index out of range");
> 
> Yes, we are accessing elements outside of the string list.
> 
> > of the replace method fails with „index out of range“ as headers has only one item.
> 
> I don't understand why this doesn't fail for me, but I know how to fix it.

Actually, no I don't. I thought we might end up getting a negative value
there, but that doesn't seem to be it, either. Nor is it uninitialized
memory from all I can tell. I still can't reproduce it on my Mac...

Hernrik, can you try this patch and attempy to reproduce the crash?
Start Subsurface so you can see stderr :-)

/D


diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index 34ad36aa283d..e1600535e707 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -469,6 +469,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
 		// now set up time, depth, temperature, po2, cns, ndl, tts, stopdepth, pressure
 		for (int i = 0; i < currColumns.count(); i++)
 			headers.append("");
+		qDebug() << "CSVApps[value].time" << CSVApps[value].time << "currColumns.count()" << currColumns.count();
 		if (CSVApps[value].time > -1 && CSVApps[value].time < currColumns.count())
 			headers.replace(CSVApps[value].time, tr("Sample time"));
 		if (CSVApps[value].depth > -1 && CSVApps[value].depth < currColumns.count())


More information about the subsurface mailing list