Closed Bug 1293940 Opened 9 years ago Closed 9 years ago

[Coverity #749800][Uninitialized members] /dom/media/MediaCache.cpp: 280 in mozilla::MediaCache::BlockOwner::BlockOwner()()

Categories

(Core :: Audio/Video: Playback, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

Details

Attachments

(1 file)

*** CID 749800: Uninitialized members (UNINIT_CTOR) /dom/media/MediaCache.cpp: 280 in mozilla::MediaCache::BlockOwner::BlockOwner()() 274 // offset is greater than or equal to the stream's current 275 // reader position 276 READAHEAD_BLOCK 277 }; 278 279 struct BlockOwner { >>> CID 749800: Uninitialized members (UNINIT_CTOR) >>> Non-static class member "mStreamBlock" is not initialized in this constructor nor in any functions that it calls. 280 BlockOwner() : mStream(nullptr), mClass(READAHEAD_BLOCK) {} 281 282 // The stream that owns this block, or null if the block is free. 283 MediaCacheStream* mStream; 284 // The block index in the stream. Valid only if mStream is non-null. 285 uint32_t mStreamBlock;
Assignee: nobody → jwwang
I've already marked it as "intentional" on Coverity's website, as I thought it was not a problem. Of course, it would be easy to just initialize it to 0 for peace of mind, up to you.
Thanks! I still want to initialize them so it won't bother any other static analysis tools.
Attachment #8779643 - Flags: review?(gsquelart)
Comment on attachment 8779643 [details] Bug 1293940 - fix uninitialized members. https://reviewboard.mozilla.org/r/70618/#review68212 r+ with nit: ::: dom/media/MediaCache.cpp:285 (Diff revision 2) > - BlockOwner() : mStream(nullptr), mClass(READAHEAD_BLOCK) {} > + constexpr BlockOwner() {} > > // The stream that owns this block, or null if the block is free. > - MediaCacheStream* mStream; > + MediaCacheStream* mStream = nullptr; > // The block index in the stream. Valid only if mStream is non-null. > - uint32_t mStreamBlock; > + // Initialized to an insane value to prevent misuse. Strictly speaking, this won't *prevent* misuse. How about "to highlight misuses" or similar?
Attachment #8779643 - Flags: review?(gsquelart) → review+
Comment on attachment 8779643 [details] Bug 1293940 - fix uninitialized members. https://reviewboard.mozilla.org/r/70618/#review68212 > Strictly speaking, this won't *prevent* misuse. > How about "to highlight misuses" or similar? Yeah, thanks for the suggestion!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: