Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed integer overflow in operator[] of (Const)PairIterator #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tensor/algstrct.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/tensor/algstrct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down