Closed
Bug 1251241
Opened 9 years ago
Closed 9 years ago
[Static Analysis][Dereference after null check] In function DrawTargetCairo::FillGlyphs
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla47
Tracking | Status | |
---|---|---|
firefox47 | --- | fixed |
People
(Reporter: andi, Assigned: andi)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, Whiteboard: CID 1354260)
Attachments
(1 file)
The Static Analysis tool Coverity added if variable |aFont| is nullptr, as it's checked below:
>> if (!aFont) {
>> gfxDevCrash(LogReason::InvalidFont) << "Invalid scaled font";
>> }
it can cause a null pointer dereference:
>> ScaledFontBase* scaledFont = static_cast<ScaledFontBase*>(aFont);
>> cairo_set_scaled_font(mContext, scaledFont->GetCairoScaledFont());
As i don't think the execution of the function can continue without sending to cairo the scaled font i thin we should return from the actual function.
Also gfxDevCrash only constructs object Log<LOG_CRITICAL, CriticalLogger> on debug mode at least.
Assignee | ||
Comment 1•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/36611/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/36611/
Attachment #8723563 -
Flags: review?(roc)
Assignee | ||
Updated•9 years ago
|
Attachment #8723563 -
Attachment description: MozReview Request: Bug 1251241 - return from DrawTargetCairo::FillGlyphs is aFont is nullptr. r?roc → MozReview Request: Bug 1251241 - return from DrawTargetCairo::FillGlyphs if |aFont| is nullptr. r?roc
Assignee | ||
Comment 2•9 years ago
|
||
Comment on attachment 8723563 [details]
MozReview Request: Bug 1251241 - return from DrawTargetCairo::FillGlyphs if |aFont| is nullptr. r?roc
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/36611/diff/1-2/
Comment on attachment 8723563 [details]
MozReview Request: Bug 1251241 - return from DrawTargetCairo::FillGlyphs if |aFont| is nullptr. r?roc
https://reviewboard.mozilla.org/r/36611/#review33231
Attachment #8723563 -
Flags: review?(roc)
Attachment #8723563 -
Flags: review+
Comment on attachment 8723563 [details]
MozReview Request: Bug 1251241 - return from DrawTargetCairo::FillGlyphs if |aFont| is nullptr. r?roc
https://reviewboard.mozilla.org/r/36611/#review33233
Comment 6•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in
before you can comment on or make changes to this bug.
Description
•