Last Comment Bug 710970 - Possible bad null-check in mjit::Compiler::performCompilation()
: Possible bad null-check in mjit::Compiler::performCompilation()
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- normal (vote)
: mozilla12
Assigned To: David Mandelin [:dmandelin]
: Jason Orendorff [:jorendorff]
Depends on:
Blocks: 710966
  Show dependency treegraph
Reported: 2011-12-14 22:46 PST by Justin Dolske [:Dolske]
Modified: 2011-12-22 03:48 PST (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch (934 bytes, patch)
2011-12-15 14:13 PST, David Mandelin [:dmandelin]
dvander: review+
Details | Diff | Splinter Review

Description User image Justin Dolske [:Dolske] 2011-12-14 22:46:06 PST

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

mjit::Compiler::performCompilation(JITScript **jitp)
    "successfully compiled (code \"%p\") (size \"%u\")\n",

  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.
Comment 1 User image David Mandelin [:dmandelin] 2011-12-15 14:13:52 PST
Created attachment 582111 [details] [diff] [review]

False positive/nit: finishThisUp returns Okay only iff *jitp is non-null.
Comment 2 User image David Anderson [:dvander] 2011-12-16 13:43:43 PST
Comment on attachment 582111 [details] [diff] [review]

Gah hit wrong button.
Comment 3 User image David Mandelin [:dmandelin] 2011-12-21 17:03:14 PST
Comment 4 User image Ed Morley [:emorley] 2011-12-22 03:48:11 PST

Note You need to log in before you can comment on or make changes to this bug.