Fix DEBUG-only crash parsing empty 'src' descriptor of @font-face rule. (Bug 511304) r=dbaron

This commit is contained in:
Zack Weinberg 2009-08-20 14:52:47 -07:00
parent b603ef9875
commit eb2100a887
4 changed files with 10 additions and 1 deletions

View File

@ -42,3 +42,4 @@ load 495269-1.html
load 495269-2.html
load 509155-1.html
load 509156-1.html
load font-face-truncated-src.html

View File

@ -0,0 +1,2 @@
<!doctype html>
<style>@font-face { src:</style>

View File

@ -7921,10 +7921,15 @@ CSSParserImpl::ParseFontSrc(nsCSSValue& aValue)
break;
}
if (values.Length() == 0)
return PR_FALSE;
nsRefPtr<nsCSSValue::Array> srcVals
= nsCSSValue::Array::Create(values.Length());
if (!srcVals)
if (!srcVals) {
mScanner.SetLowLevelError(NS_ERROR_OUT_OF_MEMORY);
return PR_FALSE;
}
PRUint32 i;
for (i = 0; i < values.Length(); i++)

View File

@ -124,6 +124,7 @@
d: {"src" : "local(\"Hoefler Text\")"}, noncanonical: true },
// Incorrect src:
{ rule: _("src:"), d: {} },
{ rule: _("src: \"/fonts/Mouse\";"), d: {} },
{ rule: _("src: /fonts/Mouse;"), d: {} },
{ rule: _("src: url(\"/fonts/Mouse\") format(truetype);"), d: {} },