[GiNaC-devel] [PATCH 4/6] symmetry::calchash(): be careful to not dereference past-the-end iterator.

Alexei Sheplyakov varg at metalica.kh.ua
Sat Aug 8 12:07:14 CEST 2009


---
 ginac/symmetry.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ginac/symmetry.cpp b/ginac/symmetry.cpp
index 9e00a8c..725506f 100644
--- a/ginac/symmetry.cpp
+++ b/ginac/symmetry.cpp
@@ -190,7 +190,8 @@ unsigned symmetry::calchash() const
 
 	if (type == none) {
 		v = rotate_left(v);
-		v ^= *(indices.begin());
+		if (!indices.empty())
+			v ^= *(indices.begin());
 	} else {
 		for (exvector::const_iterator i=children.begin(); i!=children.end(); ++i)
 		{
-- 
1.6.3.3



More information about the GiNaC-devel mailing list