Closed Bug 1334081 Opened 7 years ago Closed 7 years ago

[Static Analysis][Dereference before null check] In function EventSourceImpl::StreamReaderFunc

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1399512)

Attachments

(1 file)

The Static Analysis tool Coverity detected that a dereference before null check happens in the following context:

>>  thisObject->AssertIsOnTargetThread();
>>  EventSourceImpl* thisObject = static_cast<EventSourceImpl*>(aClosure);
>>  if (!thisObject || !aWriteCount) {
>>    NS_WARNING("EventSource cannot read from stream: no aClosure or aWriteCount");
>>    return NS_ERROR_FAILURE;
>>  }
>>  thisObject->ParseSegment((const char*)aFromRawSegment, aCount);

Even though we could assume that the entry parameter is never null we still could call AssertIsOnTargetThread after the nullptr check.
Comment on attachment 8830697 [details]
Bug 1334081 - prevent null pointer dereference in StreamReaderFunc.

https://reviewboard.mozilla.org/r/107442/#review108588
Attachment #8830697 - Flags: review?(amarchesini) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e2da10ec6bdd
prevent null pointer dereference in StreamReaderFunc. r=baku
https://hg.mozilla.org/mozilla-central/rev/e2da10ec6bdd
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: