- Fix issue with LimitIterator and bounds checking

This commit is contained in:
Marcus Boerger 2006-03-03 23:34:49 +00:00
parent ba0b3868ee
commit ce20de5e46

View File

@ -1493,7 +1493,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset);
return;
}
if (pos > intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
if (pos >= intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count);
return;
}