Closed Bug 1230913 Opened 4 years ago Closed 4 years ago

[Static Analysis][Dereference before null check] In function TextureClient::CreateWithBufferSize from TextureClient.cpp

Categories

(Core :: Graphics: Layers, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox45 --- affected
firefox46 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1338036)

Attachments

(1 file, 1 obsolete file)

The Static Analysis tool Coverity added that pointer aAllocator is dereferenced before null check, that could resul to a null poinder dereference.
Summary: [Static Analysis][Dereference before null check] In function 46TextureClient::CreateWithBufferSize from TextureClient.cpp → [Static Analysis][Dereference before null check] In function TextureClient::CreateWithBufferSize from TextureClient.cpp
Attached patch Bug 1230913.diff (obsolete) — Splinter Review
Hello Robert,

Can you please take a look other this patch?

THX
Attachment #8696444 - Flags: review?(roc)
Comment on attachment 8696444 [details] [diff] [review]
Bug 1230913.diff

Review of attachment 8696444 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with that change

::: gfx/layers/client/TextureClient.cpp
@@ +844,5 @@
>                                      size_t aSize,
>                                      TextureFlags aTextureFlags)
>  {
> +  // also test the validity of aAllocator
> +  MOZ_ASSERT(aAllocator ? aAllocator->IPCOpen() : false);

You should never use the ?: operator with a boolean constant. Here you can write
MOZ_ASSERT(aAllocator && aAllocator->IPCOpen());
Attachment #8696444 - Flags: review?(roc) → review+
Attached patch Bug 1230913.diffSplinter Review
Thx for seeing that Robert
Attachment #8696444 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/83365b2db7b9
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.