Closed Bug 1242421 Opened 4 years ago Closed 4 years ago

[Static Analysis][Dereference before null check] In function DrawTargetCairo::FillGlyphs from DrawTargetCairo.cpp

Categories

(Core :: Graphics, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox46 --- affected
firefox47 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1349972 )

Attachments

(1 file)

The Static Analysis tool Coverity added that variable mContext is null checked here:

>>  if (mContext && cairo_surface_status(cairo_get_group_target(mContext))) {
>>    gfxDebug() << "Ending FillGlyphs with a bad surface " << cairo_surface_status(cairo_get_group_target(mContext));
>>  }

Even though it's dereferenced earlier in the function. This checker is a false positive since we know for sure that at this step of the execution mContext has already been
created by the stack path:

>>	-> mozilla::gfx::DrawTargetCairo::InitAlreadyReferenced
>> 	mozilla::gfx::DrawTargetCairo::Init
>> 	mozilla::gfx::Factory::CreateDrawTargetForCairoSurface
>> 	gfxPlatform::CreateDrawTargetForSurface

So the null checker of mContext from FillGlyphs is useless.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/441b3adc9f6e
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.