Closed Bug 710970 Opened 13 years ago Closed 13 years ago

Possible bad null-check in mjit::Compiler::performCompilation()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: Dolske, Assigned: dmandelin)

References

Details

(Whiteboard: [pvs-studio])

Attachments

(1 file)

From http://www.viva64.com/en/a/0078/

Example 4. Checking a pointer for NULL only after it had been used

CompileStatus
mjit::Compiler::performCompilation(JITScript **jitp)
{
  ...
  JaegerSpew(JSpew_Scripts,
    "successfully compiled (code \"%p\") (size \"%u\")\n",
    (*jitp)->code.m_code.executableAddress(),
    unsigned((*jitp)->code.m_size));

  if (!*jitp)
      return Compile_Abort;
  ...
}

PVS-Studio diagnostic message: V595 The '* jitp' pointer was utilized before it was verified against nullptr. Check lines: 547, 549. compiler.cpp 547

By the way, using a pointer before checking it is a wide-spread error. This was one more example of this kind.
Blocks: 710966
Attached patch PatchSplinter Review
False positive/nit: finishThisUp returns Okay only iff *jitp is non-null.
Assignee: general → dmandelin
Attachment #582111 - Flags: review?(dvander)
Attachment #582111 - Flags: review?(dvander) → review-
Comment on attachment 582111 [details] [diff] [review]
Patch

Gah hit wrong button.
Attachment #582111 - Flags: review- → review+
https://hg.mozilla.org/mozilla-central/rev/092b0f19e65a
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: