Closed Bug 1361591 Opened 3 years ago Closed 3 years ago

Coverity report: nsMathMLmspaceFrame::​nsMathMLmspaceFrame(nsStyleContext *): A scalar field is not initialized by the constructor

Categories

(Core :: MathML, defect, P4, minor)

53 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox-esr52 --- unaffected
firefox53 --- wontfix
firefox54 --- wontfix
firefox55 --- fixed

People

(Reporter: mats, Assigned: fredw)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, good-first-bug, regression, Whiteboard: [CID 750316])

Attachments

(1 file)

Coverity CID 750316 Uninitialized scalar field

The field will contain an arbitrary value left over from earlier computations.

In nsMathMLmspaceFrame::​nsMathMLmspaceFrame(nsStyleContext *): A scalar field is not initialized by the constructor 

38protected:
  2. uninit_member: Non-static class member mWidth is not initialized in this constructor nor in any functions that it calls.
  4. uninit_member: Non-static class member mHeight is not initialized in this constructor nor in any functions that it calls.
  CID 750316 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)6. uninit_member: Non-static class member mDepth is not initialized in this constructor nor in any functions that it calls.
39  explicit nsMathMLmspaceFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {}
40  virtual ~nsMathMLmspaceFrame();
41
42  virtual nsresult
43  MeasureForWidth(DrawTarget* aDrawTarget,
44                  ReflowOutput& aDesiredSize) override;
45
46private:
  1. member_decl: Class member declaration for mWidth.
47  nscoord mWidth;
  3. member_decl: Class member declaration for mHeight.
48  nscoord mHeight;
  5. member_decl: Class member declaration for mDepth.
49  nscoord mDepth;
Whiteboard: [CID 750316]
Attached patch PatchSplinter Review
Assignee: nobody → fred.wang
Status: NEW → ASSIGNED
Attachment #8865111 - Flags: review?(karlt)
Comment on attachment 8865111 [details] [diff] [review]
Patch

>Bug 1361591 - Coverity report: nsMathMLmspaceFrame::ânsMathMLmspaceFrame(nsStyleContext *): A scalar field is not initialized by the constructor. r=karlt

Please describe in the commit message what the patch changes

(In reply to Mats Palmgren (:mats) from comment #1)
> We should init those three member fields to zero in the ctor:
> http://searchfox.org/mozilla-central/rev/
> abe68d5dad139e376d5521ca1d4b7892e1e7f1ba/layout/mathml/nsMathMLmspaceFrame.
> h#39

and why they should be set to zero in the constructor.
Attachment #8865111 - Flags: review?(karlt) → review?(mats)
Attachment #8865111 - Flags: review?(mats) → review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/76845c4d9d5c
Coverity report: nsMathMLmspaceFrame:nsMathMLmspaceFrame(nsStyleContext *): A scalar field is not initialized by the constructor. r=karlt
Keywords: checkin-needed
Drive-by comment, this landed with the wrong commit message (comment 3) and reviewer.
https://hg.mozilla.org/mozilla-central/rev/76845c4d9d5c
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.