Commit 78de1d02 authored by mitz@apple.com's avatar mitz@apple.com
Browse files

Use of invalid hash map key in CSSFontFaceSource::getFontData() with 0-sized remote font

https://bugs.webkit.org/show_bug.cgi?id=52598

Reviewed by Darin Adler.

Source/WebCore: 

Test: fast/css/font-face-zero-hash-key.html

* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData): Add 1 to the font size to avoid a 0 hash key.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::getFontData): Ditto.

LayoutTests: 

* fast/css/font-face-zero-hash-key-expected.txt: Added.
* fast/css/font-face-zero-hash-key.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4f1e3a43
2011-01-17 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
Use of invalid hash map key in CSSFontFaceSource::getFontData() with 0-sized remote font
https://bugs.webkit.org/show_bug.cgi?id=52598
* fast/css/font-face-zero-hash-key-expected.txt: Added.
* fast/css/font-face-zero-hash-key.html: Added.
2011-01-17 Helder Correia <helder@sencha.com>
 
Reviewed by Andreas Kling.
......
Test for an assertion failure when specifying a 0 size for a remote font.
Invisible text.
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
</script>
<style>
@font-face {
font-family: test;
src: url(resources/Ahem.ttf);
}
</style>
<p>
Test for an assertion failure when specifying a 0 size for a remote font.
</p>
<p style="font-family: test; font-size: 0;">
Invisible text.
</p>
2011-01-17 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
Use of invalid hash map key in CSSFontFaceSource::getFontData() with 0-sized remote font
https://bugs.webkit.org/show_bug.cgi?id=52598
Test: fast/css/font-face-zero-hash-key.html
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData): Add 1 to the font size to avoid a 0 hash key.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::getFontData): Ditto.
2011-01-17 David Kilzer <ddkilzer@apple.com>
 
<http://webkit.org/b/52596> Add missing DOMDocument/DOMDocumentFragment headers to Xcode project
......
......@@ -115,7 +115,7 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri
}
// See if we have a mapping in our FontData cache.
unsigned hashKey = fontDescription.computedPixelSize() << 3 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 3 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
if (SimpleFontData* cachedData = m_fontDataTable.get(hashKey))
return cachedData;
......
......@@ -88,7 +88,7 @@ FontData* CSSSegmentedFontFace::getFontData(const FontDescription& fontDescripti
return 0;
FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
unsigned hashKey = (fontDescription.computedPixelSize() << (FontTraitsMaskWidth + 1)) | ((fontDescription.orientation() == Vertical ? 1 : 0) << FontTraitsMaskWidth) | desiredTraitsMask;
unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + 1)) | ((fontDescription.orientation() == Vertical ? 1 : 0) << FontTraitsMaskWidth) | desiredTraitsMask;
SegmentedFontData* fontData = m_fontDataTable.get(hashKey);
if (fontData)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment