[med-svn] [ball] 03/06: Backport patch: Fix XDRPersistenceManager_test

Danny Edel dannyedel-guest at moszumanska.debian.org
Fri Nov 11 11:35:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

dannyedel-guest pushed a commit to branch master
in repository ball.

commit 9703ccb8ec8809fa3509df45ac3790c6a1136bd2
Author: Danny Edel <mail at danny-edel.de>
Date:   Fri Nov 11 08:12:08 2016 +0100

    Backport patch: Fix XDRPersistenceManager_test
    
    Backported from upstream commit 7380918d451a6446549bde5aaa69c10717c64158
    
    This resolves the null pointer dereference
---
 .../patches/fix-XDRPersistenceManager_test.patch   | 55 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 56 insertions(+)

diff --git a/debian/patches/fix-XDRPersistenceManager_test.patch b/debian/patches/fix-XDRPersistenceManager_test.patch
new file mode 100644
index 0000000..1032aab
--- /dev/null
+++ b/debian/patches/fix-XDRPersistenceManager_test.patch
@@ -0,0 +1,55 @@
+From 7380918d451a6446549bde5aaa69c10717c64158 Mon Sep 17 00:00:00 2001
+From: Daniel Stoeckel <dstoeckel at bioinf.uni-sb.de>
+Date: Wed, 13 Apr 2016 15:23:43 +0200
+Subject: [PATCH] Fix XDRPersistenceManager_test
+
+The test serialised a default constructed Bond, which was subsequently
+deserialised. However, this means the Bond was serialised in an invalid
+state which could trigger crashes upon deserialisation.
+
+To fix the broken test just add two Atoms to the Bond.
+
+Probably we should also make sure, that no objects in an invalid state
+can be serialised...
+
+Origin: upstream, https://github.com/BALL-Project/ball/commit/7380918d451a6446549bde5aaa69c10717c64158.patch
+---
+ source/TEST/XDRPersistenceManager_test.C | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/source/TEST/XDRPersistenceManager_test.C b/source/TEST/XDRPersistenceManager_test.C
+index 8a1ddda..51dda96 100644
+--- a/source/TEST/XDRPersistenceManager_test.C
++++ b/source/TEST/XDRPersistenceManager_test.C
+@@ -423,8 +423,13 @@ RESULT
+ 
+ CHECK([Extra] full_test0)
+ 	String filename;
++	Atom a1;
++	Atom a2;
+ 	Bond b1;
+ 
++	b1.setFirstAtom(&a1);
++	b1.setSecondAtom(&a2);
++
+ 	NEW_TMP_FILE(filename);
+ 	ofstream os(filename.c_str(), std::ios::out|std::ios::binary);
+ 	XDRPersistenceManager pm(os);
+@@ -440,7 +445,16 @@ CHECK([Extra] full_test0)
+     STATUS("After readObject...")
+ 	is.close();
+     TEST_EQUAL(RTTI::isKindOf<Bond>(po), true)
+-    delete po;
++
++	// Cleanup
++	Bond* bond = dynamic_cast<Bond*>(po);
++	delete bond->getFirstAtom();
++	delete bond->getSecondAtom();
++
++	bond->setFirstAtom(NULL);
++	bond->setSecondAtom(NULL);
++
++	delete po;
+ RESULT
+ 	
+ 
diff --git a/debian/patches/series b/debian/patches/series
index dc94d20..ca824b0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ fix-Python-bindings-for-Box.patch
 increase-sleeping-time-on-Socket_test.patch
 modify-rtti-isKindOf-to-take-pointer.patch
 fix-PoseClustering_Test-replace-file-compare-with-deserialize.patch
+fix-XDRPersistenceManager_test.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/ball.git



More information about the debian-med-commit mailing list