MINOR: ncbmbuf: improve itbmap_next() code

itbmap_next() advances an iterator over a ncbmbuf buffer storage. When
reaching the end of the buffer, <b> field is set to NULL, and the caller
is expected to stop working with the iterator.

Complete this part to ensure that itbmap type is fully initialized in
case null iterator value is returned. This is not strictly required
given the above description, but this is better to avoid any possible
future mistake.

This should fix coverity issue from github #3273.

This could be backported up to 2.8.
This commit is contained in:
Amaury Denoyelle 2026-02-23 10:04:45 +01:00
parent 868dd3e88b
commit c528824094

View File

@ -143,6 +143,8 @@ static struct itbmap itbmap_next(const struct ncbmbuf *buf,
if (off_next == ncbmb_size(buf)) {
next.b = NULL;
next.off = off_next;
next.mask = 0;
next.bits = 0;
}
else {
itbmap_load(&next, prev->off + prev->bits, buf);