summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-01 10:44:56 +0100
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-01 10:48:14 +0100
commit25926c6206a47ffb5cbfb3702e2df22038176205 (patch)
tree32aeb3716a96c974d8612216bb92ccf230183194 /src
parent97893ad738dfe3308d7e9793c301f24e6c9dc3a4 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index b39aad0..4b1d5ab 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -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_);