From a19220ae480e15fd3ce54780895e9215b0329615 Mon Sep 17 00:00:00 2001 From: Tobias Schaefer Date: Sat, 16 Dec 2023 17:37:07 +0100 Subject: [PATCH] fixed integer overflow in operator[] of (Const)PairIterator --- src/tensor/algstrct.cxx | 4 ++-- src/tensor/algstrct.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tensor/algstrct.cxx b/src/tensor/algstrct.cxx index ce9ee570..59a8315b 100644 --- a/src/tensor/algstrct.cxx +++ b/src/tensor/algstrct.cxx @@ -891,7 +891,7 @@ namespace CTF_int { sr=sr_; ptr=ptr_; } - ConstPairIterator ConstPairIterator::operator[](int n) const { + ConstPairIterator ConstPairIterator::operator[](int64_t n) const { return ConstPairIterator(sr,ptr+sr->pair_size()*n); } @@ -916,7 +916,7 @@ namespace CTF_int { ptr=ptr_; } - PairIterator PairIterator::operator[](int n) const { + PairIterator PairIterator::operator[](int64_t n) const { return PairIterator(sr,ptr+sr->pair_size()*n); } diff --git a/src/tensor/algstrct.h b/src/tensor/algstrct.h index 6672b5d6..c901a99d 100644 --- a/src/tensor/algstrct.h +++ b/src/tensor/algstrct.h @@ -462,7 +462,7 @@ namespace CTF_int { ConstPairIterator(algstrct const * sr_, char const * ptr_); /** \brief indexing moves by \param[in] n pairs */ - ConstPairIterator operator[](int n) const; + ConstPairIterator operator[](int64_t n) const; /** \brief returns key of pair at head of ptr */ int64_t k() const; @@ -513,7 +513,7 @@ namespace CTF_int { PairIterator(algstrct const * sr_, char * ptr_); /** \brief indexing moves by \param[in] n pairs */ - PairIterator operator[](int n) const; + PairIterator operator[](int64_t n) const; /** \brief returns key of pair at head of ptr */ int64_t k() const;