Closed Bug 1542556 Opened 6 years ago Closed 6 years ago

[Automated review] Incorrect consideration of "known to be nullptr"

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1544767

People

(Reporter: masayuki, Unassigned)

Details

Phabricator URL: https://phabricator.services.mozilla.com/D26423

Dereferencing "aStartPoint->GetContainerAsText()", which is known to be "nullptr".
The path that leads to this defect is:

  • editor/libeditor/WSRunObject.cpp:1307:
    path: Condition "!aStartPoint->IsSet()", taking false branch..

This means aStartPoint->mParent is not nullptr.

editor/libeditor/WSRunObject.cpp:1307:
    path: Condition "NS_warn_if_impl(!aStartPoint->IsSet(), "!aStartPoint.IsSet()", "/tmp/staticanalysis/sa-unified/editor/libeditor/WSRunObject.cpp", 1307)", taking false branch..

(out of scope of this bug, I feel odd to include debug only code here)

editor/libeditor/WSRunObject.cpp:1316:
    path: Condition "aStartPoint == aEndPoint", taking false branch..

This means that the range between aStartPoint and aEndPoint is not collapsed.

editor/libeditor/WSRunObject.cpp:1324:
    path: Condition "aStartPoint->GetContainer() == aEndPoint->GetContainer()", taking true branch..

This means that the range is in same node.

editor/libeditor/WSRunObject.cpp:1324:
    path: Condition "aStartPoint->IsInTextNode()", taking true branch..

This means that the range is in a text node.

editor/libeditor/WSRunObject.cpp:1326:
    returned_null: "GetContainerAsText" returns "nullptr" (checked 3 out of 3 times)..

So, this returns aStartParent->mParent as Text (text node). I.e., not nullptr.

editor/libeditor/WSRunObject.cpp:1326:
    dereference: Dereferencing "aStartPoint->GetContainerAsText()", which is known to be "nullptr"..

So, not return nullptr.

Yeah, coverity has false positive...

No longer blocks: coverity-analysis

The priority flag is not set for this bug.
:sylvestre, could you have a look please?

Flags: needinfo?(sledru)

We know tag the false positive ratio. So, closing

Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(sledru)
Resolution: --- → DUPLICATE
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.