Closed Bug 1232596 Opened 8 years ago Closed 8 years ago

[Static Analysis][Uninitialized scalar variable] In function CSSParserImpl::ParseDeclarationBlock from nsCSSParser.cpp

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1323118)

Attachments

(1 file)

The Static Analysis tool Coverity added that variable changed is not initialized:
>>  for (;;) {
>>    bool changed;
>>    if (!ParseDeclaration(declaration, aFlags, true, &changed, aContext)) 

Variable changed is passed by address to ParseDeclaration where it gets used without initialization below:

>>    aDeclaration->AddVariableDeclaration(varName, variableType, variableValue,
                                         status == ePriority_Important, >>false);
 >> } else {
>>    *aChanged |= mData.TransferFromBlock(mTempData, propID,
>>                                         PropertyEnabledState(),
>>                                         status == ePriority_Important,
>>                                         false, aMustCallValueAppended,
>>                                         aDeclaration, GetDocument());

Looking through code this behavior doesn't impact the application since the value stored in that variable it's not used later on, but i would still initialize it in order to silence Coverity.
Attached patch Bug 1232596.diffSplinter Review
Attachment #8698346 - Flags: review?(dbaron)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/1f2dd0904614
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.