summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Traversaro <pegua1@gmail.com>2016-08-28 12:22:50 +0200
committerGitHub <noreply@github.com>2016-08-28 12:22:50 +0200
commitd509373678c5f2fb22b50f644d63922101710ea9 (patch)
tree561e1e4e8c51561c72ec02e3dab66373bf7540bf
parentaa65c779b42fb88d99744a2cf59d4bc074645e65 (diff)
downloadswig-d509373678c5f2fb22b50f644d63922101710ea9.tar.gz
Fix use of invalid iterator
This problem is reported by running cppcheck on the generated C++, and originated in the python module, see https://sourceforge.net/p/swig/bugs/1347/ . Unfortunately it propagated through copy pasting to several other modules. The fix used here is directly extracted from the code used in the Python module, see https://github.com/swig/swig/blob/2740812970382202fe97e52f7c881eaa71c2e7c0/Lib/python/pycontainer.swg#L329 .
-rw-r--r--Lib/matlab/matlabcontainer.swg2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/matlab/matlabcontainer.swg b/Lib/matlab/matlabcontainer.swg
index bee26c15d..281442079 100644
--- a/Lib/matlab/matlabcontainer.swg
+++ b/Lib/matlab/matlabcontainer.swg
@@ -163,6 +163,8 @@ namespace swig {
std::advance(sb,ii);
std::advance(se,jj);
self->erase(sb,se);
+ sb = self->begin();
+ std::advance(sb,ii);
self->insert(sb, v.begin(), v.end());
}
}