summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2018-03-15 22:56:28 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2018-03-15 23:09:35 -0700
commit15fdb838c7361bad786098a05745edcd61c47de2 (patch)
treeaec5d4d9dac92ccc7fca7e052a0ef8bf7d89a291 /src
parent951c8f15d24a05a30a59f399b121a53a63ff3d41 (diff)
ubsan: Fix type mismatch in compact mode for document data
We were misaligning document data on 64-bit platforms by placing 8b pointers at 4b offsets; fix this by reserving a full pointer worth of bytes for page marker.
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 9e6fe48..94dca48 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -6875,7 +6875,8 @@ namespace pugi
assert(!_root);
#ifdef PUGIXML_COMPACT
- const size_t page_offset = sizeof(uint32_t);
+ // space for page marker for the first page (uint32_t), rounded up to pointer size; assumes pointers are at least 32-bit
+ const size_t page_offset = sizeof(void*);
#else
const size_t page_offset = 0;
#endif