[Static Analysis][Dereference before null check] In functions nsScriptLoader::ProcessScriptElement and nsScriptLoader::StartLoad

RESOLVED FIXED in Firefox 51

Status

()

Core
DOM
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: andi, Assigned: andi)

Tracking

(Blocks: 1 bug, {coverity})

Trunk
mozilla51
coverity
Points:
---

Firefox Tracking Flags

(firefox51 fixed)

Details

(Whiteboard: CID 1372813, CID 1372812, CID 1372814)

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
The Static Analysis tool Coverity detected that there are several place where dereference before null check appears:

>>  // If this document is sandboxed without 'allow-scripts', abort.
>>  if (mDocument->HasScriptsBlockedBySandbox()) {
>>    return NS_OK;
>>  } 

and 

>>  // Check to see if scripts has been turned off.
>>  if (!mEnabled || !mDocument->IsScriptEnabled()) {
>>    return false;
>>  }

I think it is safe to guard the usage with NS_ENSURE_TRUE
Comment hidden (mozreview-request)

Comment 2

2 years ago
mozreview-review
Comment on attachment 8791092 [details]
Bug 1302658 - substitute null checks with NS_ENSURE_TRUE.

https://reviewboard.mozilla.org/r/78642/#review77224
Attachment #8791092 - Flags: review?(amarchesini) → review+

Comment 3

2 years ago
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bd37ea2f83d3
substitute null checks with NS_ENSURE_TRUE. r=baku

Comment 4

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/bd37ea2f83d3
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox51: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.