From 5ffab34d13448989844e265bef373a24e85b6579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Sat, 7 Sep 2019 10:31:12 +0200 Subject: [PATCH] fix rangecheck --- libsrc/core/python_ngcore.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/core/python_ngcore.hpp b/libsrc/core/python_ngcore.hpp index 45832009..f52c104e 100644 --- a/libsrc/core/python_ngcore.hpp +++ b/libsrc/core/python_ngcore.hpp @@ -65,7 +65,7 @@ namespace ngcore if (!slice.compute(self.Size(), &start, &stop, &step, &slicelength)) throw py::error_already_set(); static constexpr int base = IndexBASE(); - if (start < base || start+slicelength*step >= self.Size()+base) + if (start < base || start+(slicelength-1)*step >= self.Size()+base) throw py::index_error(); for (size_t i = 0; i < slicelength; i++, start+=step) self[start] = val;