@@ -99,10 +99,10 @@ CouponList<A>* CouponList<A>::newList(const void* bytes, size_t len, const A& al
9999 const bool emptyFlag = ((data[hll_constants::FLAGS_BYTE ] & hll_constants::EMPTY_FLAG_MASK ) ? true : false );
100100
101101 const uint32_t couponCount = data[hll_constants::LIST_COUNT_BYTE ];
102- // Reject LIST counts larger than the fixed LIST capacity.
102+ // Reject LIST counts at or above the fixed LIST capacity.
103103 const uint32_t listCapacity = 1u << hll_constants::LG_INIT_LIST_SIZE ;
104- if (couponCount > listCapacity) {
105- throw std::invalid_argument (" Attempt to deserialize invalid CouponList with couponCount > capacity. Found couponCount: "
104+ if (couponCount >= listCapacity) {
105+ throw std::invalid_argument (" Attempt to deserialize invalid CouponList with couponCount >= capacity. Found couponCount: "
106106 + std::to_string (couponCount)
107107 + " , capacity: " + std::to_string (listCapacity));
108108 }
@@ -154,10 +154,10 @@ CouponList<A>* CouponList<A>::newList(std::istream& is, const A& allocator) {
154154 const bool emptyFlag = ((listHeader[hll_constants::FLAGS_BYTE ] & hll_constants::EMPTY_FLAG_MASK ) ? true : false );
155155
156156 const uint32_t couponCount = listHeader[hll_constants::LIST_COUNT_BYTE ];
157- // Reject LIST counts larger than the fixed LIST capacity.
157+ // Reject LIST counts at or above the fixed LIST capacity.
158158 const uint32_t listCapacity = 1u << hll_constants::LG_INIT_LIST_SIZE ;
159- if (couponCount > listCapacity) {
160- throw std::invalid_argument (" Attempt to deserialize invalid CouponList with couponCount > capacity. Found couponCount: "
159+ if (couponCount >= listCapacity) {
160+ throw std::invalid_argument (" Attempt to deserialize invalid CouponList with couponCount >= capacity. Found couponCount: "
161161 + std::to_string (couponCount)
162162 + " , capacity: " + std::to_string (listCapacity));
163163 }
0 commit comments