Closed Bug 1302442 Opened 8 years ago Closed 8 years ago

[Static Analysis][Uninitialized scalar field] In Codegen.py

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox51 --- fix-optional
firefox52 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1372681, CID 1372682, CID 1372683, CID 1372684, CID 1372685, CID 1372686, CID 1372688, CID 1372689, CID 1372690)

Attachments

(1 file)

The Static Analysis tool Coverity detected that there are many uninitialised member variables in classes generated through Codegen.py. For example in SubleCryptoBinding.h:

>>struct RsaPssParams : public Algorithm
>>{
>>  uint32_t mSaltLength;
>>
>>  RsaPssParams();
>>
>>  explicit inline RsaPssParams(const FastDictionaryInitializer& )
>>    : Algorithm(FastDictionaryInitializer())
>>  {
>>    // Do nothing here; this is used by our "Fast" subclass
>>  }

We should eliminate from scanning these variables by modifying Codegen.py that for each member variable to add annotation: MOZ_INIT_OUTSIDE_CTOR
Or we can initialize them in the CTOR.
Attachment #8790749 - Flags: review?(amarchesini) → review?(peterv)
(In reply to Andrea Marchesini [:baku] from comment #2)
> Or we can initialize them in the CTOR.
I think that's a little bit harder since we don't know the type of the variable only its literal type name.
Comment on attachment 8790749 [details]
Bug 1302442 - Add ignore-initialization-check annotation to class member variables constructed by Codegen.

https://reviewboard.mozilla.org/r/78430/#review78220

You need to change the ClassMember constructor to take a bool that signals whether to add this annotation. Prefixing the type makes the type member incorrect.
Attachment #8790749 - Flags: review?(peterv) → review-
Comment on attachment 8790749 [details]
Bug 1302442 - Add ignore-initialization-check annotation to class member variables constructed by Codegen.

https://reviewboard.mozilla.org/r/78430/#review79238
Attachment #8790749 - Flags: review?(peterv) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d28809f3b445
Add ignore-initialization-check annotation to class member variables constructed by Codegen. r=peterv
https://hg.mozilla.org/mozilla-central/rev/d28809f3b445
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Mark 51 as fix-optional. If it's worth uplifting to 51, feel free to nominate it.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: