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)

defect
Not set
normal

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.
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
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)
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
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.

Attachment

General

Creator:
Created:
Updated:
Size: