Closed Bug 991336 Opened 6 years ago Closed 6 years ago

CID 750186: Uninitialized scalar field in jsinfer.h as found by Coverity

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: gkw, Assigned: bhackett)

References

(Blocks 1 open bug)

Details

(Keywords: coverity)

Attachments

(1 file)

Coverity analysis of source code in js/src has found an Uninitialized scalar field issue, that probably happened from Feb to Mar 2014.


________________________________________________________________________________________________________
*** CID 750186:  Uninitialized scalar field  (UNINIT_CTOR)
/js/src/jsinfer.h: 1453 in js::types::CompilerOutput::CompilerOutput()()
1447         // outputs are removed. This gives the new index for a valid compiler output.
1448         uint32_t sweepIndex_ : 29;
1449     
1450       public:
1451         CompilerOutput()
1452           : script_(nullptr), mode_(SequentialExecution), pendingInvalidation_(false)
>>>     CID 750186:  Uninitialized scalar field  (UNINIT_CTOR)
>>>     Non-static class member "sweepIndex_" is not initialized in this constructor nor in any functions that it calls.
1453         {}
1454     
1455         CompilerOutput(JSScript *script, ExecutionMode mode)
1456           : script_(script), mode_(mode), pendingInvalidation_(false)
1457         {}
1458     

Waldo, any idea what's going on here?
Flags: needinfo?(jwalden+bmo)
> field issue, that probably happened from Feb to Mar 2014.

Hmmm, not exactly true, probably it's from Nov 2013 to Jan 2014 instead.
Summary: Uninitialized scalar field in jsinfer.h as found by Coverity → CID 750186: Uninitialized scalar field in jsinfer.h as found by Coverity
Flags: needinfo?(jwalden+bmo) → needinfo?(bhackett1024)
Attached patch patchSplinter Review
The sweep indexes are initialized during GC sweeping and are only used during that time, so this code is fine.  Still, it would be better if we more strongly checked that this field is being used properly, as this patch does.
Assignee: nobody → bhackett1024
Attachment #8404753 - Flags: review?(jdemooij)
Flags: needinfo?(bhackett1024)
Comment on attachment 8404753 [details] [diff] [review]
patch

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

Much nicer/safer.
Attachment #8404753 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/f74e5c063883
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.