Open Bug 1361577 Opened 3 years ago Updated 8 days ago

coverity report: In BCPaintBorderIterator::​SetNewRowGroup(): All paths that lead to this null pointer comparison already dereference the pointer earlier

Categories

(Core :: Layout: Tables, enhancement, P3, trivial)

enhancement

Tracking

()

ASSIGNED

People

(Reporter: mats, Assigned: shrey2809)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, good-first-bug)

Attachments

(1 file)

Coverity CID 749559 Dereference before null check

There may be a null pointer dereference, or else the comparison against null is unnecessary.

In BCPaintBorderIterator::​SetNewRowGroup(): All paths that lead to this null pointer comparison already dereference the pointer earlier 

6811BCPaintBorderIterator::SetNewRowGroup()
6812{
6813
6814  mRgIndex++;
6815
6816  mIsRepeatedHeader = false;
6817  mIsRepeatedFooter = false;
6818
6819  NS_ASSERTION(mRgIndex >= 0, "mRgIndex out of bounds");
6820  if (uint32_t(mRgIndex) < mRowGroups.Length()) {
    alias: Assigning: this->mPrevRg = this->mRg.
6821    mPrevRg = mRg;
6822    mRg = mRowGroups[mRgIndex];
    deref_ptr_in_call: Dereferencing pointer this->mRg. (The dereference happens because this is a virtual function call.)
6823    nsTableRowGroupFrame* fifRg =
6824      static_cast<nsTableRowGroupFrame*>(mRg->FirstInFlow());
6825    mFifRgFirstRowIndex = fifRg->GetStartRowIndex();
6826    mRgFirstRowIndex    = mRg->GetStartRowIndex();
6827    mRgLastRowIndex     = mRgFirstRowIndex + mRg->GetRowCount() - 1;
6828
6829    if (SetNewRow(mRg->GetFirstRow())) {
6830      mCellMap = mTableCellMap->GetMapFor(fifRg, nullptr);
6831      if (!mCellMap) ABORT1(false);
6832    }
    CID 749559 (#1 of 1): Dereference before null check (REVERSE_INULL)check_after_deref: Null-checking this->mRg suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
6833    if (mRg && mTable->GetPrevInFlow() && !mRg->GetPrevInFlow()) {
Priority: -- → P3

Hello,I would like to work on this bug

Assignee: nobody → shrey2809
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.