From: Sun Yuechi Date: Tue, 23 Jun 2026 10:18:25 +0000 (+0800) Subject: test/bufferlist: avoid BenchDeref iterator overrun past end X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3a9a837ef7c220aa04ab0f4d124f5a2d372a0bac;p=ceph.git test/bufferlist: avoid BenchDeref iterator overrun past end Drive the deref loop by get_remaining() >= step instead of comparing to end(), so a total length that is not a multiple of step no longer lets `iter += step` run past the end and throw "End of buffer". The original counts were always a multiple of step, so the overrun only showed up once the following commit shrinks the rounds under ASan -- a false alarm rather than a real regression, which is why it went unnoticed until now. Signed-off-by: Sun Yuechi --- diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index ba83f532934..41b47c61029 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -823,7 +823,7 @@ static void bench_bufferlistiter_deref(const size_t step, utime_t start = ceph_clock_now(); bufferlist::iterator iter = bl.begin(); - while (iter != bl.end()) { + while (iter.get_remaining() >= step) { iter += step; } utime_t end = ceph_clock_now();