summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node_statics.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-30 21:29:11 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-30 21:29:11 +0000
commitc40c5aa2d7f1753dd382c35955deafdaca660020 (patch)
treeb427f5516046d40b8dd63f8c7a552fac0bf278ae /xfa/fxfa/parser/cxfa_node_statics.cpp
parent9daec60824d085db8c2f841fd389c725df1f8b0b (diff)
downloadpdfium-c40c5aa2d7f1753dd382c35955deafdaca660020.tar.xz
A CXFA_Node can only be in one packet
When a CXFA_Node is created it's created as part of a specific packet. Previously the code would accept an XFA_XDPPACKET which was stored internally. This had the potential to allow a node to exist in multiple packets. This CL changes the XFA_XDPPacket to the XFA_PacketType enum class and cleans up a lot of uses to use the more specific packet type. Change-Id: I7fc8c843bfa6bd32295ae58a26bcec311e43c4b0 Reviewed-on: https://pdfium-review.googlesource.com/20012 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node_statics.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_node_statics.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/xfa/fxfa/parser/cxfa_node_statics.cpp b/xfa/fxfa/parser/cxfa_node_statics.cpp
index 1d7d05892b..64b70ee88b 100644
--- a/xfa/fxfa/parser/cxfa_node_statics.cpp
+++ b/xfa/fxfa/parser/cxfa_node_statics.cpp
@@ -922,7 +922,7 @@ XFA_Attribute CXFA_Node::NameToAttribute(const WideStringView& name) {
// static
std::unique_ptr<CXFA_Node> CXFA_Node::Create(CXFA_Document* doc,
XFA_Element element,
- XFA_XDPPACKET packet) {
+ XFA_PacketType packet) {
ASSERT(element != XFA_Element::NodeList);
std::unique_ptr<CXFA_Node> node;
switch (element) {
@@ -1864,7 +1864,8 @@ std::unique_ptr<CXFA_Node> CXFA_Node::Create(CXFA_Document* doc,
NOTREACHED();
return nullptr;
}
- if (!node || !node->IsValidInPacket(packet))
+ if (!node || !node->IsValidInPacket(static_cast<XFA_XDPPACKET>(
+ 1 << static_cast<uint8_t>(packet))))
return nullptr;
return node;
}