mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
buffer: fix advance(unsigned) to avoid int underflow
by chaning - the signature of advance(unsigned) to advance(size_t) - the signature of seek(int) to seek(ssize_t) Fixes: http://tracker.ceph.com/issues/16010 Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
b262e46599
commit
053bfa650b
@ -1041,7 +1041,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
|
||||
: iterator_impl<is_const>(i.bl, i.off, i.p, i.p_off) {}
|
||||
|
||||
template<bool is_const>
|
||||
void buffer::list::iterator_impl<is_const>::advance(int o)
|
||||
void buffer::list::iterator_impl<is_const>::advance(ssize_t o)
|
||||
{
|
||||
//cout << this << " advance " << o << " from " << off << " (p_off " << p_off << " in " << p->length() << ")" << std::endl;
|
||||
if (o > 0) {
|
||||
@ -1080,7 +1080,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
|
||||
}
|
||||
|
||||
template<bool is_const>
|
||||
void buffer::list::iterator_impl<is_const>::seek(unsigned o)
|
||||
void buffer::list::iterator_impl<is_const>::seek(size_t o)
|
||||
{
|
||||
p = ls->begin();
|
||||
off = p_off = 0;
|
||||
@ -1247,12 +1247,12 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
|
||||
: iterator_impl(l, o, ip, po)
|
||||
{}
|
||||
|
||||
void buffer::list::iterator::advance(int o)
|
||||
void buffer::list::iterator::advance(ssize_t o)
|
||||
{
|
||||
buffer::list::iterator_impl<false>::advance(o);
|
||||
}
|
||||
|
||||
void buffer::list::iterator::seek(unsigned o)
|
||||
void buffer::list::iterator::seek(size_t o)
|
||||
{
|
||||
buffer::list::iterator_impl<false>::seek(o);
|
||||
}
|
||||
|
@ -308,8 +308,8 @@ namespace buffer CEPH_BUFFER_API {
|
||||
//return off == bl->length();
|
||||
}
|
||||
|
||||
void advance(int o);
|
||||
void seek(unsigned o);
|
||||
void advance(ssize_t o);
|
||||
void seek(size_t o);
|
||||
char operator*() const;
|
||||
iterator_impl& operator++();
|
||||
ptr get_current_ptr() const;
|
||||
@ -351,8 +351,8 @@ namespace buffer CEPH_BUFFER_API {
|
||||
iterator(bl_t *l, unsigned o=0);
|
||||
iterator(bl_t *l, unsigned o, list_iter_t ip, unsigned po);
|
||||
|
||||
void advance(int o);
|
||||
void seek(unsigned o);
|
||||
void advance(ssize_t o);
|
||||
void seek(size_t o);
|
||||
char operator*();
|
||||
iterator& operator++();
|
||||
ptr get_current_ptr();
|
||||
|
Loading…
Reference in New Issue
Block a user