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

RESOLVED FIXED in Thunderbird 50.0

Status

MailNews Core
Filters
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: ISHIKAWA, Chiaki, Assigned: ISHIKAWA, Chiaki)

Tracking

(Blocks: 1 bug, {coverity})

Trunk
Thunderbird 50.0
coverity

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
(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.
(Assignee)

Comment 1

2 years ago
Created attachment 8759211 [details] [diff] [review]
Set  |mIframeToDiv| to false in class object initialization code.

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)

Updated

2 years ago
Assignee: nobody → ishikawa
Blocks: 1230156

Updated

2 years ago
Component: OS Integration → Filters
Product: Thunderbird → MailNews Core

Comment 2

2 years ago
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+

Updated

2 years ago
Status: NEW → ASSIGNED
OS: Unspecified → All
Hardware: Unspecified → All
Keywords: coverity

Updated

2 years ago
Keywords: checkin-needed

Comment 3

2 years ago
https://hg.mozilla.org/comm-central/rev/0eb5ec48cc492e1ce6a7827a9ee5d7533eb70439
Status: ASSIGNED → RESOLVED
Last Resolved: 2 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.