Add luci mirror repository
[librecmc/librecmc.git] / package / libs / uclibc++ / patches / 050-Bugfix-erase-on-derived-__base_associative.patch
1 From 946b29e62927eadfc4e87f27b8d30e5974b78c4c Mon Sep 17 00:00:00 2001
2 From: Ben Kelly <ben@benjii.net>
3 Date: Mon, 6 Feb 2017 13:08:25 +0200
4 Subject: [PATCH] Bugfix erase() on derived __base_associative
5
6 When calling erase() on a containers derived from __base_associative
7 (e.g. multimap) and providing a pair of iterators a segfault will
8 occur.
9
10 Example code to reproduce:
11
12         typedef std::multimap<int, int> testmap;
13         testmap t;
14         t.insert(std::pair<int, int>(1, 1));
15         t.insert(std::pair<int, int>(2, 1));
16         t.insert(std::pair<int, int>(3, 1));
17         t.erase(t.begin(), t.end());
18
19 Signed-off-by: Ben Kelly <ben@benjii.net>
20 ---
21  include/associative_base | 3 +--
22  1 file changed, 1 insertion(+), 2 deletions(-)
23
24 diff --git a/include/associative_base b/include/associative_base
25 index 27ae0ef..be8b27f 100644
26 --- a/include/associative_base
27 +++ b/include/associative_base
28 @@ -200,8 +200,7 @@ public:
29         }
30         void erase(iterator first, iterator last){
31                 while(first != last){
32 -                       backing.erase(first.base_iterator());
33 -                       ++first;
34 +                       first = backing.erase(first.base_iterator());
35                 }
36         }
37  
38 -- 
39 2.7.4
40