mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
fix nullptr passed to memcmp/memcpy reported by ubsan
This commit is contained in:
@@ -191,7 +191,7 @@ public:
|
|||||||
if (newCapacity > 0)
|
if (newCapacity > 0)
|
||||||
{
|
{
|
||||||
ptr = new T[newCapacity];
|
ptr = new T[newCapacity];
|
||||||
if (preserveContent)
|
if (preserveContent && _ptr)
|
||||||
{
|
{
|
||||||
std::size_t newSz = _used < newCapacity ? _used : newCapacity;
|
std::size_t newSz = _used < newCapacity ? _used : newCapacity;
|
||||||
std::memcpy(ptr, _ptr, newSz * sizeof(T));
|
std::memcpy(ptr, _ptr, newSz * sizeof(T));
|
||||||
|
|||||||
Reference in New Issue
Block a user