index: protect against overflow in need_records calculation