Closed Bug 1299110 Opened 10 years ago Closed 10 years ago

[Static Analysis][Dereference before null check] In function ContentParent::AllocateLayerTreeId

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1372301)

Attachments

(1 file)

The Static Analysis tool Coverity detected that |aContent| is dereference before being null checked, witch implies that this pointer can be null thus leading to a possible null pointer dereference. >>1702 GPUProcessManager* gpu = GPUProcessManager::Get(); >>1703 >>1704 *aId = gpu->AllocateLayerTreeId(); >>1705 gpu->MapLayerTreeId(*aId, aContent->OtherPid()); >>1706 >>1707 if (!gfxPlatform::AsyncPanZoomEnabled()) { >>1708 return true; >>1709 } >>1710 >>1711 if (!aContent || !aTopLevel) { >>1712 return false; >>1713 } >>1714 >>1715 return aContent->SendNotifyLayerAllocated(aTabId, *aId); >>1716} As it can be seen that at line 1705 aContent is dereferenced and at line 1711 it's null checked. I think the correct behaviour in this case would be to have the null check placed right after the assignment from line 1704.
Comment on attachment 8786307 [details] Bug 1299110 - prevent null pointer dereference in AllocateLayerTreeId. https://reviewboard.mozilla.org/r/75282/#review73156
Attachment #8786307 - Flags: review?(amarchesini) → review+
Pushed by bpostelnicu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/315eb26957c8 prevent null pointer dereference in AllocateLayerTreeId. r=baku
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: