Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: third_party/WebKit/Source/core/xml/XPathValue.h

Issue 2424453002: Handle overflow, underflow in XPath substring position, length. (Closed)
Patch Set: Address nit. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/xml/XPathPredicate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef XPathValue_h 27 #ifndef XPathValue_h
28 #define XPathValue_h 28 #define XPathValue_h
29 29
30 #include "core/CoreExport.h"
30 #include "core/xml/XPathNodeSet.h" 31 #include "core/xml/XPathNodeSet.h"
31 #include "wtf/text/WTFString.h" 32 #include "wtf/text/WTFString.h"
32 33
33 namespace blink { 34 namespace blink {
34 35
35 namespace XPath { 36 namespace XPath {
36 37
37 struct EvaluationContext; 38 struct EvaluationContext;
38 39
39 class ValueData : public GarbageCollectedFinalized<ValueData> { 40 class ValueData : public GarbageCollectedFinalized<ValueData> {
(...skipping 17 matching lines...) Expand all
57 : m_nodeSet(NodeSet::create(nodeSet)) {} 58 : m_nodeSet(NodeSet::create(nodeSet)) {}
58 explicit ValueData(NodeSet* nodeSet) : m_nodeSet(nodeSet) {} 59 explicit ValueData(NodeSet* nodeSet) : m_nodeSet(nodeSet) {}
59 explicit ValueData(const String& string) 60 explicit ValueData(const String& string)
60 : m_string(string), m_nodeSet(NodeSet::create()) {} 61 : m_string(string), m_nodeSet(NodeSet::create()) {}
61 62
62 Member<NodeSet> m_nodeSet; 63 Member<NodeSet> m_nodeSet;
63 }; 64 };
64 65
65 // Copying Value objects makes their data partially shared, so care has to be 66 // Copying Value objects makes their data partially shared, so care has to be
66 // taken when dealing with copies. 67 // taken when dealing with copies.
67 class Value { 68 class CORE_EXPORT Value {
68 DISALLOW_NEW(); 69 DISALLOW_NEW();
69 70
70 public: 71 public:
71 enum Type { NodeSetValue, BooleanValue, NumberValue, StringValue }; 72 enum Type { NodeSetValue, BooleanValue, NumberValue, StringValue };
72 73
73 Value(unsigned value) : m_type(NumberValue), m_bool(false), m_number(value) {} 74 Value(unsigned value) : m_type(NumberValue), m_bool(false), m_number(value) {}
74 Value(unsigned long value) 75 Value(unsigned long value)
75 : m_type(NumberValue), m_bool(false), m_number(value) {} 76 : m_type(NumberValue), m_bool(false), m_number(value) {}
76 Value(double value) : m_type(NumberValue), m_bool(false), m_number(value) {} 77 Value(double value) : m_type(NumberValue), m_bool(false), m_number(value) {}
77 78
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 137
137 template <> 138 template <>
138 inline Value::Value(bool value) 139 inline Value::Value(bool value)
139 : m_type(BooleanValue), m_bool(value), m_number(0) {} 140 : m_type(BooleanValue), m_bool(value), m_number(0) {}
140 141
141 } // namespace XPath 142 } // namespace XPath
142 143
143 } // namespace blink 144 } // namespace blink
144 145
145 #endif // XPathValue_h 146 #endif // XPathValue_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/xml/XPathPredicate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698