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

View: New views
1 Messages — Rating Filter:   Alert me  

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

by Alexei Sheplyakov-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

---
 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

_______________________________________________
GiNaC-devel mailing list
GiNaC-devel@...
https://www.cebix.net/mailman/listinfo/ginac-devel