[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#859756: unblock: xapian-core/1.4.3-2



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package xapian-core 1.4.3-2.  It's successfully built
on all release architectures (and most non-release ones).

This upload fixes important severity bug #857693 which is an upstream
bug which can lead to incorrect results being returned for queries
with certain boolean filters:

https://bugs.debian.org/857693

There are no other changes over 1.4.3-1, the version in testing.

I've attached a debdiff, which is the fix cherry-picked from upstream
git.  Most of the size is actually test coverage for the change in
the patch, so for easy review I've also attached a version of the
debdiff with that added test coverage removed.

In case you're not familiar with C++ details the key difference here
is that the new version initialises the allocated array to be all
0.0 (the old version left the memory uninitialised):

-      max_wt = new double [n_kids];
+      max_wt = new double [n_kids]();

unblock xapian-core/1.4.3-2

Cheers,
    Olly
diff -Nru xapian-core-1.4.3/debian/changelog xapian-core-1.4.3/debian/changelog
--- xapian-core-1.4.3/debian/changelog	2017-01-25 14:40:08.000000000 +1300
+++ xapian-core-1.4.3/debian/changelog	2017-04-06 06:48:18.000000000 +1200
@@ -1,3 +1,10 @@
+xapian-core (1.4.3-2) unstable; urgency=medium
+
+  * Fix incorrect results for unweighted AND with certain subqueries (new
+    patch fix-unweighted-and.patch).  (Closes: #857693)
+
+ -- Olly Betts <olly@survex.com>  Thu, 06 Apr 2017 06:48:18 +1200
+
 xapian-core (1.4.3-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch
--- xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch	1970-01-01 12:00:00.000000000 +1200
+++ xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch	2017-04-06 06:48:18.000000000 +1200
@@ -0,0 +1,66 @@
+Description: Fix incorrect results due to uninitialised memory
+    The array holding max weight values in MultiAndPostList is never
+    initialised if the operator is unweighted, but the values are still
+    used to calculate the max weight to pass to subqueries, leading to
+    incorrect results.  This can be observed with an OR under an unweighted
+    AND (e.g. OR under AND on the right side of AND_NOT).
+    
+    The fix applied is to simply default initialise this array, which
+    should lead to a max weight of 0.0 being passed on to subqueries.
+    
+    Bug reported in notmuch by Kirill A. Shutemov, and forwarded by
+    David Bremner.
+Author: Olly Betts <olly@survex.com>
+Bug-Debian: https://bugs.debian.org/857693
+Origin: upstream
+Last-Update: 2017-04-06
+
+--- a/matcher/multiandpostlist.cc
++++ b/matcher/multiandpostlist.cc
+@@ -32,7 +32,7 @@
+ {
+     plist = new PostList * [n_kids];
+     try {
+-	max_wt = new double [n_kids];
++	max_wt = new double [n_kids]();
+     } catch (...) {
+ 	delete [] plist;
+ 	plist = NULL;
+--- a/tests/api_query.cc
++++ b/tests/api_query.cc
+@@ -658,3 +658,18 @@
+ 
+     return true;
+ }
++
++// Regression test for bug fixed in 1.4.4 and 1.2.25.
++DEFINE_TESTCASE(notandor1, backend) {
++    Xapian::Database db(get_database("etext"));
++    Xapian::Query q =
++	Xapian::Query("the") &~ (Xapian::Query("friedrich") &
++		(Xapian::Query("day") | Xapian::Query("night")));
++    Xapian::Enquire enq(db);
++    enq.set_query(q);
++
++    Xapian::MSet mset = enq.get_mset(0, 10, db.get_doccount());
++    TEST_EQUAL(mset.get_matches_estimated(), 344);
++
++    return true;
++}
+--- a/tests/api_collated.h
++++ b/tests/api_collated.h
+@@ -301,6 +301,7 @@
+ 	    { "zeroestimate1", test_zeroestimate1 },
+ 	    { "complexphrase3", test_complexphrase3 },
+ 	    { "complexnear3", test_complexnear3 },
++	    { "notandor1", test_notandor1 },
+ 	    { "wildquery1", test_wildquery1 },
+ 	    { "snippet1", test_snippet1 },
+ 	    { "snippetstem1", test_snippetstem1 },
+--- a/tests/api_query.h
++++ b/tests/api_query.h
+@@ -21,3 +21,4 @@
+ extern bool test_complexphrase3();
+ extern bool test_complexnear3();
+ extern bool test_subdbwithoutpos1();
++extern bool test_notandor1();
diff -Nru xapian-core-1.4.3/debian/patches/series xapian-core-1.4.3/debian/patches/series
--- xapian-core-1.4.3/debian/patches/series	1970-01-01 12:00:00.000000000 +1200
+++ xapian-core-1.4.3/debian/patches/series	2017-04-06 06:48:13.000000000 +1200
@@ -0,0 +1 @@
+fix-unweighted-and.patch
diff -Nru xapian-core-1.4.3/debian/changelog xapian-core-1.4.3/debian/changelog
--- xapian-core-1.4.3/debian/changelog	2017-01-25 14:40:08.000000000 +1300
+++ xapian-core-1.4.3/debian/changelog	2017-04-06 06:48:18.000000000 +1200
@@ -1,3 +1,10 @@
+xapian-core (1.4.3-2) unstable; urgency=medium
+
+  * Fix incorrect results for unweighted AND with certain subqueries (new
+    patch fix-unweighted-and.patch).  (Closes: #857693)
+
+ -- Olly Betts <olly@survex.com>  Thu, 06 Apr 2017 06:48:18 +1200
+
 xapian-core (1.4.3-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch
--- xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch	1970-01-01 12:00:00.000000000 +1200
+++ xapian-core-1.4.3/debian/patches/fix-unweighted-and.patch	2017-04-06 06:48:18.000000000 +1200
@@ -0,0 +1,66 @@
+Description: Fix incorrect results due to uninitialised memory
+    The array holding max weight values in MultiAndPostList is never
+    initialised if the operator is unweighted, but the values are still
+    used to calculate the max weight to pass to subqueries, leading to
+    incorrect results.  This can be observed with an OR under an unweighted
+    AND (e.g. OR under AND on the right side of AND_NOT).
+    
+    The fix applied is to simply default initialise this array, which
+    should lead to a max weight of 0.0 being passed on to subqueries.
+    
+    Bug reported in notmuch by Kirill A. Shutemov, and forwarded by
+    David Bremner.
+Author: Olly Betts <olly@survex.com>
+Bug-Debian: https://bugs.debian.org/857693
+Origin: upstream
+Last-Update: 2017-04-06
+
+--- a/matcher/multiandpostlist.cc
++++ b/matcher/multiandpostlist.cc
+@@ -32,7 +32,7 @@
+ {
+     plist = new PostList * [n_kids];
+     try {
+-	max_wt = new double [n_kids];
++	max_wt = new double [n_kids]();
+     } catch (...) {
+ 	delete [] plist;
+ 	plist = NULL;
diff -Nru xapian-core-1.4.3/debian/patches/series xapian-core-1.4.3/debian/patches/series
--- xapian-core-1.4.3/debian/patches/series	1970-01-01 12:00:00.000000000 +1200
+++ xapian-core-1.4.3/debian/patches/series	2017-04-06 06:48:13.000000000 +1200
@@ -0,0 +1 @@
+fix-unweighted-and.patch

Attachment: signature.asc
Description: PGP signature


Reply to: