Index: matcher/multimatch.cc
===================================================================
--- matcher/multimatch.cc	(revision 9004)
+++ matcher/multimatch.cc	(working copy)
@@ -752,7 +752,7 @@
 			items.end(),
 			mcmp);
 	    // Erase the unwanted trailing items.
-	    items.erase(items.begin() + first + maxitems);
+	    items.erase(items.begin() + first + maxitems, items.end());
 	}
     }
     if (first > 0) {
