mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 01:00:48 +00:00
Fix UBSan report in HashTable
This commit is contained in:
parent
0cdd48e468
commit
626b9a3ae9
@ -710,9 +710,21 @@ public:
|
||||
return iterator(this, ptr);
|
||||
}
|
||||
|
||||
const_iterator end() const { return const_iterator(this, buf + grower.bufSize()); }
|
||||
const_iterator cend() const { return end(); }
|
||||
iterator end() { return iterator(this, buf + grower.bufSize()); }
|
||||
const_iterator end() const
|
||||
{
|
||||
/// Avoid UBSan warning about adding zero to nullptr. It is valid in C++20 (and earlier) but not valid in C.
|
||||
return const_iterator(this, buf ? buf + grower.bufSize() : buf);
|
||||
}
|
||||
|
||||
const_iterator cend() const
|
||||
{
|
||||
return end();
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return iterator(this, buf ? buf + grower.bufSize() : buf);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
@ -935,6 +947,9 @@ public:
|
||||
if (this->hasZero())
|
||||
this->zeroValue()->write(wb);
|
||||
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
for (auto ptr = buf, buf_end = buf + grower.bufSize(); ptr < buf_end; ++ptr)
|
||||
if (!ptr->isZero(*this))
|
||||
ptr->write(wb);
|
||||
@ -951,6 +966,9 @@ public:
|
||||
this->zeroValue()->writeText(wb);
|
||||
}
|
||||
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
for (auto ptr = buf, buf_end = buf + grower.bufSize(); ptr < buf_end; ++ptr)
|
||||
{
|
||||
if (!ptr->isZero(*this))
|
||||
|
Loading…
Reference in New Issue
Block a user