[mdds] Resolves: rhbz#680766 fix a crash and two other bugs

David Tardon dtardon at fedoraproject.org
Thu Mar 24 15:07:56 UTC 2011


commit 8eafca338bcb64dd2ca260f99b4c4f3b468e921e
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Mar 24 16:07:43 2011 +0100

    Resolves: rhbz#680766 fix a crash and two other bugs

 add-missing-link.patch          |   15 +++++++++++++
 compare-to-the-other-node.patch |   19 +++++++++++++++++
 do-not-insert-new-node.patch    |   43 +++++++++++++++++++++++++++++++++++++++
 mdds.spec                       |   11 +++++++++-
 4 files changed, 87 insertions(+), 1 deletions(-)
---
diff --git a/add-missing-link.patch b/add-missing-link.patch
new file mode 100644
index 0000000..a3d0991
--- /dev/null
+++ b/add-missing-link.patch
@@ -0,0 +1,15 @@
+# HG changeset patch
+# Parent d5fb760990e45ae0db4f4b7609d8affb85101a39
+add missing link
+
+diff -r d5fb760990e4 -r c08b02a02f23 include/mdds/flat_segment_tree_def.inl
+--- a/include/mdds/flat_segment_tree_def.inl	Thu Mar 24 14:52:10 2011 +0100
++++ b/include/mdds/flat_segment_tree_def.inl	Thu Mar 24 14:53:14 2011 +0100
+@@ -438,6 +438,7 @@
+             m_left_leaf->value_leaf.value = m_init_val;
+             new_node->left = m_left_leaf;
+             new_node->right = m_left_leaf->right;
++            m_left_leaf->right->left = new_node;
+             m_left_leaf->right = new_node;
+         }
+ 
diff --git a/compare-to-the-other-node.patch b/compare-to-the-other-node.patch
new file mode 100644
index 0000000..e0f5f11
--- /dev/null
+++ b/compare-to-the-other-node.patch
@@ -0,0 +1,19 @@
+# HG changeset patch
+# Parent 9b68208cb03bb3ece046c8b60a6a0777fea46d4a
+fix typo in node::equals
+
+diff -r 9b68208cb03b include/mdds/node.hpp
+--- a/include/mdds/node.hpp	Fri Feb 11 11:24:57 2011 -0500
++++ b/include/mdds/node.hpp	Thu Mar 24 08:27:28 2011 +0100
+@@ -154,9 +154,9 @@
+             return false;
+ 
+         if (is_leaf)
+-            return value_leaf == value_leaf;
++            return value_leaf == r.value_leaf;
+         else
+-            return value_nonleaf == value_nonleaf;
++            return value_nonleaf == r.value_nonleaf;
+ 
+         return true;
+     }
diff --git a/do-not-insert-new-node.patch b/do-not-insert-new-node.patch
new file mode 100644
index 0000000..e08a5c6
--- /dev/null
+++ b/do-not-insert-new-node.patch
@@ -0,0 +1,43 @@
+# HG changeset patch
+# Parent ff6ad274f8ecb1715d366ddb53ecafd422252660
+do not insert new node if the whole range was shifted
+
+diff -r ff6ad274f8ec include/mdds/flat_segment_tree_def.inl
+--- a/include/mdds/flat_segment_tree_def.inl	Thu Mar 24 14:54:16 2011 +0100
++++ b/include/mdds/flat_segment_tree_def.inl	Thu Mar 24 14:55:26 2011 +0100
+@@ -430,16 +430,25 @@
+ 
+         if (m_left_leaf->value_leaf.value != m_init_val)
+         {
+-            // The leftmost leaf node has a non-initial value.  We need to
+-            // insert a new node to carry that value after the shift.
+-            node_ptr new_node(new node(true));
+-            new_node->value_leaf.key = pos + size;
+-            new_node->value_leaf.value = m_left_leaf->value_leaf.value;
+-            m_left_leaf->value_leaf.value = m_init_val;
+-            new_node->left = m_left_leaf;
+-            new_node->right = m_left_leaf->right;
+-            m_left_leaf->right->left = new_node;
+-            m_left_leaf->right = new_node;
++            if (size < m_right_leaf->value_leaf.key - m_left_leaf->value_leaf.key)
++            {
++                // The leftmost leaf node has a non-initial value.  We need to
++                // insert a new node to carry that value after the shift.
++                node_ptr new_node(new node(true));
++                new_node->value_leaf.key = pos + size;
++                new_node->value_leaf.value = m_left_leaf->value_leaf.value;
++                m_left_leaf->value_leaf.value = m_init_val;
++                new_node->left = m_left_leaf;
++                new_node->right = m_left_leaf->right;
++                m_left_leaf->right->left = new_node;
++                m_left_leaf->right = new_node;
++            }
++            else
++            {
++                // We shifted out the whole range, so there would be no new
++                // node inserted. Just set default value.
++                m_left_leaf->value_leaf.value = m_init_val;
++            }
+         }
+ 
+         m_valid_tree = false;
diff --git a/mdds.spec b/mdds.spec
index 139c19d..5d8cae1 100644
--- a/mdds.spec
+++ b/mdds.spec
@@ -3,7 +3,7 @@
 
 Name: mdds
 Version: 0.5.1
-Release: 2%{?dist}
+Release: 3%{?dist}
 Summary: A collection of multi-dimensional data structures and indexing algorithms
 
 Group: Development/Libraries
@@ -11,6 +11,9 @@ License: MIT
 URL: http://code.google.com/p/multidimalgorithm/
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Source0: http://multidimalgorithm.googlecode.com/files/%{name}_%{version}.tar.bz2
+Patch0: compare-to-the-other-node.patch
+Patch1: add-missing-link.patch
+Patch2: do-not-insert-new-node.patch
 
 BuildRequires: boost-devel
 %if %{do_mem_tests}
@@ -42,6 +45,9 @@ Headers for %{name}.
 
 %prep
 %setup -q -n %{name}_%{version}
+%patch0 -p1 -b .compare-to-the-other-node.patch
+%patch1 -p1 -b .add-missing-link.patch
+%patch2 -p1 -b .do-not-insert-new-node.patch
 # this is only used in tests
 sed -i -e '/^CPPFLAGS/s/-Wall.*-std/%{optflags} -std/' Makefile.in
 
@@ -86,6 +92,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Thu Mar 24 2011 David Tardon <dtardon at redhat.com> - 0.5.1-3
+- Resolves: rhbz#680766 fix a crash and two other bugs
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.5.1-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list