Closed Bug 1302658 Opened 8 years ago Closed 8 years ago

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

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

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

Attachments

(1 file)

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 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+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bd37ea2f83d3
substitute null checks with NS_ENSURE_TRUE. r=baku
https://hg.mozilla.org/mozilla-central/rev/bd37ea2f83d3
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
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: