The commit message says it all...

miika
From 427f99e8c6a7db175807e4b2b1a14dd32f920403 Mon Sep 17 00:00:00 2001
From: Miika Turkia <[email protected]>
Date: Tue, 8 Sep 2015 20:12:29 +0300
Subject: [PATCH] Fix a crash on divelogs.de export

Subsurface crashes when multiple dives are selected on divelogs.de
export. The crash occurs on malloc that is called indirectly from
xmlReadMemory().

Signed-off-by: Miika Turkia <[email protected]>
---
I don't really understand what goes wrong here, as the memory buffer
looks to be correct. It might be that the internal state of XML parser
is left dirty if we use same memory buffer on subsequent runs. Anyway,
re-allocating the membuffer for each dive is the best I was able to come
up with.
---
 qt-ui/subsurfacewebservices.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 1722da4..e2e3b3e 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -175,7 +175,6 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
 	/* walk the dive list in chronological order */
 	int i;
 	struct dive *dive;
-	struct membuffer mb = { 0 };
 	for_each_dive (i, dive) {
 		FILE *f;
 		char filename[PATH_MAX];
@@ -183,6 +182,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
 		const char *membuf;
 		xmlDoc *transformed;
 		struct zip_source *s;
+		struct membuffer mb = { 0 };
 
 		/*
 		 * Get the i'th dive in XML format so we can process it.
-- 
2.1.4

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to