summaryrefslogtreecommitdiffstats
path: root/layout/style/nsCSSParser.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-10 16:59:13 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-10 16:59:13 +0100
commit9697bfa68f32984b196748e388d743dddbe6aa7b (patch)
tree3d8d23560d512199fbc8334bd15514d70ea00268 /layout/style/nsCSSParser.cpp
parent7d398710beb67e03bf1690f73cdfd1ef2b76d31a (diff)
parentfbbda481dce5c367b4ccdeacc70cdcd7f68ac8af (diff)
downloadUXP-9697bfa68f32984b196748e388d743dddbe6aa7b.tar
UXP-9697bfa68f32984b196748e388d743dddbe6aa7b.tar.gz
UXP-9697bfa68f32984b196748e388d743dddbe6aa7b.tar.lz
UXP-9697bfa68f32984b196748e388d743dddbe6aa7b.tar.xz
UXP-9697bfa68f32984b196748e388d743dddbe6aa7b.zip
Merge branch 'master' into Sync-weave
Diffstat (limited to 'layout/style/nsCSSParser.cpp')
-rw-r--r--layout/style/nsCSSParser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index b361cf0c2..33e5fe56d 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -1549,6 +1549,9 @@ protected:
// All data from successfully parsed properties are placed into |mData|.
nsCSSExpandedDataBlock mData;
+
+ // Value to make sure our resolved variable results stay within sane limits.
+ const int32_t MAX_CSS_VAR_LENGTH = 10240;
public:
// Used from nsCSSParser constructors and destructors
@@ -2802,6 +2805,12 @@ CSSParserImpl::ResolveValueWithVariableReferencesRec(
// Invalid variable with no fallback.
return false;
}
+ // Make sure we are still using sane sizes for value and
+ // variableValue, and abort if OOB.
+ if (value.Length() > MAX_CSS_VAR_LENGTH ||
+ variableValue.Length() > MAX_CSS_VAR_LENGTH) {
+ return false;
+ }
// Valid variable with no fallback.
AppendTokens(value, valueFirstToken, valueLastToken,
varFirstToken, varLastToken, variableValue);