mirror of https://github.com/aria2/aria2
Fixed out of array bound
parent
02b3873e6d
commit
f6f053cae1
|
@ -103,11 +103,14 @@ public:
|
||||||
T next()
|
T next()
|
||||||
{
|
{
|
||||||
T res;
|
T res;
|
||||||
if(index_ < segs_.size()) {
|
size_t len = segs_.size();
|
||||||
|
if(index_ < len) {
|
||||||
res = val_++;
|
res = val_++;
|
||||||
if(val_ == segs_[index_].second) {
|
if(val_ == segs_[index_].second) {
|
||||||
++index_;
|
++index_;
|
||||||
val_ = segs_[index_].first;
|
if(index_ < len) {
|
||||||
|
val_ = segs_[index_].first;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
Loading…
Reference in New Issue