Skip to content

Commit 810b860

Browse files
committed
Bug 2036400 - Initialize uninitialized scalar fields in js to fix Coverity uninitialized-scalar defects r=spidermonkey-reviewers,mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D298131
1 parent 8b52e50 commit 810b860

23 files changed

Lines changed: 39 additions & 39 deletions

‎js/public/ProfilingFrameIterator.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class MOZ_NON_PARAM JS_PUBLIC_API ProfilingFrameIterator {
6666
// profiler uses this to skip native frames between the activation and
6767
// endStackAddress_.
6868
void* endStackAddress_ = nullptr;
69-
Kind kind_;
69+
Kind kind_ = Kind::JSJit;
7070

7171
static const unsigned StorageSpace = 9 * sizeof(void*);
7272
alignas(void*) unsigned char storage_[StorageSpace];

‎js/src/builtin/TestingFunctions.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4604,7 +4604,7 @@ class MOZ_STACK_CLASS IterativeFailureTest {
46044604

46054605
JSContext* const cx;
46064606
FailureSimulator& simulator;
4607-
size_t compartmentCount;
4607+
size_t compartmentCount = 0;
46084608

46094609
// Test parameters set by initParams.
46104610
RootedFunction testFunction;

‎js/src/frontend/ExpressionStatementEmitter.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MOZ_STACK_CLASS ExpressionStatementEmitter {
3535

3636
#ifdef DEBUG
3737
// The stack depth before emitting expression.
38-
int32_t depth_;
38+
int32_t depth_ = 0;
3939
#endif
4040

4141
// The usage of the value of the expression.

‎js/src/gc/GCRuntime.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class BackgroundMarkTask : public GCParallelTask {
152152
bool isOverBudget() { return budget.isOverBudget(); }
153153

154154
private:
155-
bool isConcurrent;
155+
bool isConcurrent = false;
156156
JS::SliceBudget budget;
157157
JS::SliceBudget::InterruptRequestFlag interruptRequest;
158158
friend class GCRuntime;

‎js/src/gc/Nursery.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ class Nursery {
632632

633633
#ifdef JS_GC_ZEAL
634634
// Report on the kinds of things promoted.
635-
bool reportPromotion_;
635+
bool reportPromotion_ = false;
636636
#endif
637637

638638
// Whether to report information on pretenuring, and if so the allocation

‎js/src/jit/CacheIRCompiler.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ class FailurePath {
649649
Vector<OperandLocation, 4, SystemAllocPolicy> inputs_;
650650
SpilledRegisterVector spilledRegs_;
651651
NonAssertingLabel label_;
652-
uint32_t stackPushed_;
652+
uint32_t stackPushed_ = 0;
653653
#ifdef DEBUG
654654
// Flag to ensure FailurePath::label() isn't taken while there's a scratch
655655
// float register which still needs to be restored.

‎js/src/jit/CompileInfo.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class CompileInfo {
372372
bool hadBoundsCheckBailout_;
373373
bool hadUnboxFoldingBailout_;
374374

375-
bool branchHintingEnabled_;
375+
bool branchHintingEnabled_ = false;
376376

377377
bool mayReadFrameArgsDirectly_;
378378
bool anyFormalIsForwarded_;

‎js/src/jit/MIR-wasm.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ class MWasmStackResultArea : public MNullaryInstruction {
18471847
public:
18481848
class StackResult {
18491849
// Offset in bytes from lowest address of stack result area.
1850-
uint32_t offset_;
1850+
uint32_t offset_ = 0;
18511851
MIRType type_;
18521852

18531853
public:

‎js/src/jit/Snapshots.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class SnapshotWriter {
446446
RValueAllocMap allocMap_;
447447

448448
// This is only used to assert sanity.
449-
uint32_t allocWritten_;
449+
uint32_t allocWritten_ = 0;
450450

451451
// Used to report size of the snapshot in the spew messages.
452452
SnapshotOffset lastStart_;
@@ -481,8 +481,8 @@ class MNode;
481481
class RecoverWriter {
482482
CompactBufferWriter writer_;
483483

484-
uint32_t instructionCount_;
485-
uint32_t instructionsWritten_;
484+
uint32_t instructionCount_ = 0;
485+
uint32_t instructionsWritten_ = 0;
486486

487487
public:
488488
SnapshotOffset startRecover(uint32_t instructionCount);

‎js/src/vm/AtomsTable.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ struct js::AtomHasher::Lookup {
3737
const char* utf8Bytes;
3838
};
3939
enum { TwoByteChar, Latin1, UTF8 } type;
40-
size_t length;
41-
size_t byteLength;
42-
const JSAtom* atom; /* Optional. */
40+
size_t length = 0;
41+
size_t byteLength = 0;
42+
const JSAtom* atom = nullptr; /* Optional. */
4343
JS::AutoCheckCannotGC nogc;
4444

45-
HashNumber hash;
45+
HashNumber hash = 0;
4646

4747
MOZ_ALWAYS_INLINE Lookup(const char* utf8Bytes, size_t byteLen, size_t length,
4848
HashNumber hash)

0 commit comments

Comments
 (0)