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

RESOLVED FIXED in Firefox 55

Status

()

defect
P4
minor
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: mats, Assigned: emilio)

Tracking

(Blocks 1 bug, {coverity, good-first-bug, regression})

53 Branch
mozilla55
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr52 unaffected, firefox53 wontfix, firefox54 wontfix, firefox55 fixed)

Details

(Whiteboard: [lang=C++][CID 1396665], )

Coverity CID 1396665 Uninitialized scalar field

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

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


 65protected:
 66  explicit BRFrame(nsStyleContext* aContext)
 67    : nsFrame(aContext, LayoutFrameType::Br)
   CID 1396665 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)2. uninit_member: Non-static class member mAscent is not initialized in this constructor nor in any functions that it calls.
 68  {}
This is sort of a false positive since we only use mAscent in GetLogicalBaseline()
and mAscent is always set in Reflow(), and Reflow() must be called before
GetLogicalBaseline().

We should probably init mAscent in the ctor to NS_INTRINSIC_WIDTH_UNKNOWN anyway
to catch any errors.  (Maybe also rename it to mBaseline to follow the naming
convention used in other classes.)
https://hg.mozilla.org/mozilla-central/rev/952e377dbace
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Assignee: nobody → emilio+bugs
Whiteboard: [lang=C++] → [lang=C++][CID 1396665]
You need to log in before you can comment on or make changes to this bug.