mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
Issue #2489: Disallow percentage overflow and underflow
This commit is contained in:
parent
5fe574de22
commit
052b5d1ffa
1 changed files with 10 additions and 6 deletions
|
|
@ -7491,9 +7491,11 @@ CSSParserImpl::ParseColor(nsCSSValue& aValue)
|
|||
if (mToken.mType == eCSSToken_Percentage) {
|
||||
w1 = mToken.mNumber; // percentage tokens are already normalized (0.0-1.0)
|
||||
w1_specified = true;
|
||||
// clamp to valid range [0, 1]
|
||||
if (w1 < 0.0f) w1 = 0.0f;
|
||||
if (w1 > 1.0f) w1 = 1.0f;
|
||||
// Reject invalid percentages (outside 0-100% range)
|
||||
if (w1 < 0.0f || w1 > 1.0f) {
|
||||
SkipUntil(')');
|
||||
return CSSParseResult::Error;
|
||||
}
|
||||
} else {
|
||||
UngetToken();
|
||||
}
|
||||
|
|
@ -7517,9 +7519,11 @@ CSSParserImpl::ParseColor(nsCSSValue& aValue)
|
|||
if (mToken.mType == eCSSToken_Percentage) {
|
||||
w2 = mToken.mNumber; // percentage tokens are already normalized (0.0-1.0)
|
||||
w2_specified = true;
|
||||
// Clamp to valid range [0, 1]
|
||||
if (w2 < 0.0f) w2 = 0.0f;
|
||||
if (w2 > 1.0f) w2 = 1.0f;
|
||||
// Reject invalid percentages (outside 0-100% range)
|
||||
if (w2 < 0.0f || w2 > 1.0f) {
|
||||
SkipUntil(')');
|
||||
return CSSParseResult::Error;
|
||||
}
|
||||
} else {
|
||||
UngetToken();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue