summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-04 10:14:33 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-04 16:11:41 +0100
commitc637e34da807b82aebca82f7c82eb01e2ddb0f02 (patch)
tree976f205cc53d7491f8ec04681a0421459392fc9a /external
parente3530d2c9d5dc98c6bacf243c163d651624e1ba6 (diff)
ofz#4048 Null-dereference
Change-Id: I52db987ac3f11e318e2adf1ee797054f49c31f98 Reviewed-on: https://gerrit.libreoffice.org/44293 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'external')
-rw-r--r--external/mdds/UnpackedTarball_mdds.mk1
-rw-r--r--external/mdds/ofz-4048.patch.148
2 files changed, 49 insertions, 0 deletions
diff --git a/external/mdds/UnpackedTarball_mdds.mk b/external/mdds/UnpackedTarball_mdds.mk
index c015f4c13f5a..1958b32c2cb4 100644
--- a/external/mdds/UnpackedTarball_mdds.mk
+++ b/external/mdds/UnpackedTarball_mdds.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,mdds,$(MDDS_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,0))
$(eval $(call gb_UnpackedTarball_add_patches,mdds,\
+ external/mdds/ofz-4048.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/mdds/ofz-4048.patch.1 b/external/mdds/ofz-4048.patch.1
new file mode 100644
index 000000000000..887a53ef9e28
--- /dev/null
+++ b/external/mdds/ofz-4048.patch.1
@@ -0,0 +1,48 @@
+diff --git a/include/mdds/flat_segment_tree_def.inl b/include/mdds/flat_segment_tree_def.inl
+index 58de366..00cc1c6 100644
+--- a/include/mdds/flat_segment_tree_def.inl
++++ b/include/mdds/flat_segment_tree_def.inl
+@@ -778,7 +778,7 @@ bool flat_segment_tree<_Key, _Value>::adjust_segment_range(key_type& start_key,
+ // Invalid order of segment range.
+ return false;
+
+- if (end_key < m_left_leaf->value_leaf.key || start_key > m_right_leaf->value_leaf.key)
++ if (end_key < m_left_leaf->value_leaf.key || start_key >= m_right_leaf->value_leaf.key)
+ // The new segment does not overlap the current interval.
+ return false;
+
+diff --git a/src/flat_segment_tree_test.cpp b/src/flat_segment_tree_test.cpp
+index bb29918..b94f0fd 100644
+--- a/src/flat_segment_tree_test.cpp
++++ b/src/flat_segment_tree_test.cpp
+@@ -1986,6 +1986,22 @@ void fst_test_insert_out_of_bound()
+ pos = ret.first;
+ }
+
++void fst_test_insert_out_of_bound_2()
++{
++ stack_printer __stack_printer__("::fst_test_insert_out_of_bound_2");
++
++ typedef flat_segment_tree<int, bool> db_type;
++ db_type db(0, 256, false);
++
++ // The range is entirely out-of-bound, but the start range equals the
++ // upper bound of the valid range.
++ auto ret = db.insert_back(256, 1024, true);
++
++ // Insertion never took place.
++ assert(ret.first == db.end());
++ assert(!ret.second);
++}
++
+ void fst_test_segment_iterator()
+ {
+ stack_printer __stack_printer__("::fst_test_segment_iterator");
+@@ -2115,6 +2131,7 @@ int main (int argc, char **argv)
+ fst_test_assignment();
+ fst_test_non_numeric_value();
+ fst_test_insert_out_of_bound();
++ fst_test_insert_out_of_bound_2();
+ fst_test_segment_iterator();
+ }
+