From 8fa654f2637fa755e890499ece1a7bc498779ea3 Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Sat, 8 Aug 2009 13:03:38 +0300 Subject: [PATCH] ncmul::eval(): don't write beyond the end of the vector. --- ginac/ncmul.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index f21f8572..adc36a52 100644 --- a/ginac/ncmul.cpp +++ b/ginac/ncmul.cpp @@ -339,15 +339,15 @@ ex ncmul::eval(int level) const if (assocseq.empty()) return _ex1; // determine return types - unsignedvector rettypes; - rettypes.reserve(assocseq.size()); + unsignedvector rettypes(assocseq.size()); size_t i = 0; size_t count_commutative=0; size_t count_noncommutative=0; size_t count_noncommutative_composite=0; cit = assocseq.begin(); citend = assocseq.end(); while (cit != citend) { - switch (rettypes[i] = cit->return_type()) { + rettypes[i] = cit->return_type(); + switch (rettypes[i]) { case return_types::commutative: count_commutative++; break; -- 2.44.0