0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-28 14:48:43 +08:00

XPath: Fix undefined behavior while calling memcpy

Calling memcpy(x, 0, 0) is technically undefined (although it should usually
be a no-op).

Fixes #20.
This commit is contained in:
Arseny Kapoulkine 2014-11-01 10:44:56 +01:00
parent 97893ad738
commit 25926c6206

View File

@ -7764,6 +7764,8 @@ PUGI__NS_BEGIN
void append(const xpath_node* begin_, const xpath_node* end_, xpath_allocator* alloc)
{
if (begin_ == end_) return;
size_t size_ = static_cast<size_t>(_end - _begin);
size_t capacity = static_cast<size_t>(_eos - _begin);
size_t count = static_cast<size_t>(end_ - begin_);