[Static Analysis] Possible null-dereference in nsMaiInterfaceText.cpp

RESOLVED FIXED in Firefox 63

Status

()

P3
normal
RESOLVED FIXED
5 months ago
5 months ago

People

(Reporter: rbartlensky, Assigned: rbartlensky)

Tracking

(Blocks: 1 bug)

unspecified
mozilla63
Points:
---

Firefox Tracking Flags

(firefox63 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 months ago
infer reports the following error:
accessible/atk/nsMaiInterfaceText.cpp:467: error: NULL_DEREFERENCE
  pointer `textAcc` last assigned on line 465 could be null and is dereferenced at line 467, column 7.
  465.       HyperTextAccessible* textAcc = accWrap->AsHyperText();
  466.       return
  467. >       textAcc->IsDefunct() ? 0 : static_cast<gint>(textAcc->CharacterCount());
  468.     }
  469.

https://dxr.mozilla.org/mozilla-central/source/accessible/atk/nsMaiInterfaceText.cpp#467

textAcc can be null because `AsHyperText` can return null. I have checked to see if the code that calls `getCharacterCountCB` ever ensures that `aText` is a hyper text, but it is never the case. This means that the warning is indeed true.
Comment hidden (mozreview-request)
(Assignee)

Updated

5 months ago
Attachment #8989748 - Flags: review?(dbolter)
Comment on attachment 8989748 [details]
Bug 1472672: Add null check for textAcc.

ok with me
Attachment #8989748 - Flags: review?(dbolter) → review+
Keywords: checkin-needed

Comment 3

5 months ago
Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c463161da7b4
Add null check for textAcc. r=davidb
Keywords: checkin-needed

Comment 4

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/c463161da7b4
Status: NEW → RESOLVED
Last Resolved: 5 months ago
status-firefox63: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Blocks: 1175203
You need to log in before you can comment on or make changes to this bug.