Closed Bug 1277604 Opened 4 years ago Closed 4 years ago

(coverity) nsBayesianFilter.cpp : |mIframeToDiv| may not be initialized properly all the time.

Categories

(MailNews Core :: Filters, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 50.0

People

(Reporter: ishikawa, Assigned: ishikawa)

References

(Blocks 1 open bug)

Details

(Keywords: coverity)

Attachments

(1 file)

(Coverity static checker found this.)
In mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp,
|mIframeToDiv| may not be initialized properly all the time.

Other member variables are properly initialized in case they may not be defined in the profile.
We should do so for |mIframeToDiv|.

(Actually, the initialization is not done when earlier exit is taken, but even then I wonder why |mIframeToDiv| is not handled as other variables are in the initialization code.)

The patch follows.
I set  |mIframeToDiv| to false which is the default value when it is not defined in profile.

(Like I said this initialization does not happen if the early exit is taken a few lines above. We better be ready for such unusual case. "Safety first programming" is important.)
Assignee: nobody → ishikawa
Component: OS Integration → Filters
Product: Thunderbird → MailNews Core
Comment on attachment 8759211 [details] [diff] [review]
Set  |mIframeToDiv| to false in class object initialization code.

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

Looks reasonable to me. You mean the member is not initialized when any of the NS_ENSURE_SUCCESS_VOID fire, because after the GetBoolPref() we always initialize it to something.
Attachment #8759211 - Flags: review+
Status: NEW → ASSIGNED
OS: Unspecified → All
Hardware: Unspecified → All
Keywords: coverity
Keywords: checkin-needed
https://hg.mozilla.org/comm-central/rev/0eb5ec48cc492e1ce6a7827a9ee5d7533eb70439
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 50.0
You need to log in before you can comment on or make changes to this bug.