Closed Bug 1228497 Opened 10 years ago Closed 10 years ago

[Static Analysis][Uninitialized Members In Class] Class nsCSPParser from nsCSPParser.cpp has 3 member variables unintialized

Categories

(Core :: DOM: Security, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1340247)

Attachments

(1 file, 1 obsolete file)

The Static Analysis tool Coverity added the following in class nsCSPParser: 1. uninit_member: Non-static class member mCurChar is not initialized in this constructor nor in any functions that it calls. 2. uninit_member: Non-static class member mEndChar is not initialized in this constructor nor in any functions that it calls. 3. uninit_member: Non-static class member mPolicy is not initialized in this constructor nor in any functions that it calls.
Whiteboard: CID 1340247
Attached patch Bug 1228497.diff (obsolete) — Splinter Review
Hello Sid, Could you please take a look other this patch and tell me what you think? THX
Attachment #8692815 - Flags: review?(mozbugs)
Comment on attachment 8692815 [details] [diff] [review] Bug 1228497.diff Review of attachment 8692815 [details] [diff] [review]: ----------------------------------------------------------------- Yeah, I think it would be good to initialize those. Chris, you wrote most of the parser; this makes sense, right?
Attachment #8692815 - Flags: review?(mozbugs) → review?(mozilla)
Comment on attachment 8692815 [details] [diff] [review] Bug 1228497.diff Review of attachment 8692815 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/security/nsCSPParser.cpp @@ +131,5 @@ > , mCSPContext(aCSPContext) > , mDeliveredViaMetaTag(aDeliveredViaMetaTag) > + , mCurChar(nullptr) > + , mEndChar(nullptr) > + , mPolicy(nullptr) Yeah, that sounds great, but the initialization list needs to match the order of the members in the *.h file, otherwise they will be initialized after object construction.
Attachment #8692815 - Flags: review?(mozilla)
Attached patch Bug 1228497.diffSplinter Review
Thanks for catching that, otherwise the build would have crashed since we are treating this compile warnings as errors, witch is good!
Attachment #8692815 - Attachment is obsolete: true
Attachment #8697187 - Flags: review?(mozilla)
Comment on attachment 8697187 [details] [diff] [review] Bug 1228497.diff Review of attachment 8697187 [details] [diff] [review]: ----------------------------------------------------------------- Thanks, r=me
Attachment #8697187 - Flags: review?(mozilla) → review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: