From 55585d0f93de1a0e60858e594b1b3b46f4a0831f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 22 Aug 2018 09:54:07 +0200 Subject: Don't use invalid iterator in Fallback-Of handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cppcheck reports: (error) Iterator 't' used after element has been erased. The loop is actually fashioned to deal with this (not in the most efficient way, but in simplest and speed isn't really a concern here) IF this codepath had a "break" at the end… so I added one. Note that the tests aren't failing before (and hopefully after) the change as the undefined behavior we encounter is too stable. Thanks: David Binderman for reporting --- apt-pkg/deb/debmetaindex.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/deb/debmetaindex.cc') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 6cbed85a7..9c7c70784 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1043,6 +1043,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ auto const tv = *t; mytargets.erase(t); mytargets.emplace_back(tv); + break; } if (Changed == false) break; -- cgit v1.2.3