Bug 152772 - [SVG -> OTF Converter] Parsing failures cause use of incomplete fonts
Summary: [SVG -> OTF Converter] Parsing failures cause use of incomplete fonts
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-01-05 21:22 PST by Myles C. Maxfield
Modified: 2016-01-10 21:55 PST (History)
5 users (show)

See Also:


Attachments
Patch (9.41 KB, patch)
2016-01-05 21:24 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (9.48 KB, patch)
2016-01-05 21:25 PST, Myles C. Maxfield
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2016-01-05 21:22:22 PST
[SVG -> OTF Converter] Parsing failures cause use of incomplete fonts
Comment 1 Myles C. Maxfield 2016-01-05 21:24:55 PST
Created attachment 268353 [details]
Patch
Comment 2 Myles C. Maxfield 2016-01-05 21:25:38 PST
Created attachment 268354 [details]
Patch
Comment 3 Myles C. Maxfield 2016-01-05 21:26:27 PST
<rdar://problem/24043104>
Comment 4 Said Abou-Hallawa 2016-01-06 12:14:39 PST
Comment on attachment 268354 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268354&action=review

> Source/WebCore/svg/SVGToOTFFontConversion.cpp:61
> +    bool error() const

Why is this function needed? Can't we check m_error in functions like SVGToOTFFontConverter::convertSVGToOTFFont() and return immediately if its value is true?

> Source/WebCore/svg/SVGToOTFFontConversion.cpp:1583
>      SVGToOTFFontConverter converter(element);

Since SVGToOTFFontConverter::processGlyphElement() sets m_error to true and since it's called from the constructor of SVGToOTFFontConverter, should not we check converter.m_error before calling SVGToOTFFontConverter::convertSVGToOTFFont()? If m_error is true we are going to return Nullopt anyway.

> Source/WebCore/svg/SVGToOTFFontConversion.cpp:1586
> +        return Nullopt;

Can't this if-statment be written like this?

if (!converter.convertSVGToOTFFont())
     return Nullopt;
Comment 5 Myles C. Maxfield 2016-01-10 18:56:34 PST
Comment on attachment 268354 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268354&action=review

>> Source/WebCore/svg/SVGToOTFFontConversion.cpp:61
>> +    bool error() const
> 
> Why is this function needed? Can't we check m_error in functions like SVGToOTFFontConverter::convertSVGToOTFFont() and return immediately if its value is true?

I anticipate there may be new sources of errors in the future which should result in conversion failure.

>> Source/WebCore/svg/SVGToOTFFontConversion.cpp:1583
>>      SVGToOTFFontConverter converter(element);
> 
> Since SVGToOTFFontConverter::processGlyphElement() sets m_error to true and since it's called from the constructor of SVGToOTFFontConverter, should not we check converter.m_error before calling SVGToOTFFontConverter::convertSVGToOTFFont()? If m_error is true we are going to return Nullopt anyway.

Yeah, this is a good idea.

>> Source/WebCore/svg/SVGToOTFFontConversion.cpp:1586
>> +        return Nullopt;
> 
> Can't this if-statment be written like this?
> 
> if (!converter.convertSVGToOTFFont())
>      return Nullopt;

👍
Comment 6 Myles C. Maxfield 2016-01-10 21:55:30 PST
Committed r194839: <http://trac.webkit.org/changeset/194839>