diff options
Diffstat (limited to 'libutils/VectorImpl.cpp')
-rw-r--r-- | libutils/VectorImpl.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libutils/VectorImpl.cpp b/libutils/VectorImpl.cpp index d951b8bbb..c97a19bc6 100644 --- a/libutils/VectorImpl.cpp +++ b/libutils/VectorImpl.cpp @@ -279,12 +279,14 @@ ssize_t VectorImpl::replaceAt(const void* prototype, size_t index) ssize_t VectorImpl::removeItemsAt(size_t index, size_t count) { - size_t end; - LOG_ALWAYS_FATAL_IF(__builtin_add_overflow(index, count, &end), "overflow: index=%zu count=%zu", - index, count); - if (end > size()) return BAD_VALUE; - _shrink(index, count); - return index; + ALOG_ASSERT((index+count)<=size(), + "[%p] remove: index=%d, count=%d, size=%d", + this, (int)index, (int)count, (int)size()); + + if ((index+count) > size()) + return BAD_VALUE; + _shrink(index, count); + return index; } void VectorImpl::finish_vector() |