From 25926c6206a47ffb5cbfb3702e2df22038176205 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sat, 1 Nov 2014 10:44:56 +0100 Subject: 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. --- src/pugixml.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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(_end - _begin); size_t capacity = static_cast(_eos - _begin); size_t count = static_cast(end_ - begin_); -- cgit v1.2.3