Bug 30774 - [V8] Missing null check after string conversion in error reporting
Summary: [V8] Missing null check after string conversion in error reporting
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-26 06:47 PDT by Mads Ager
Modified: 2009-10-27 11:03 PDT (History)
4 users (show)

See Also:


Attachments
Add null check. (1.81 KB, patch)
2009-10-26 06:53 PDT, Mads Ager
abarth: review-
Details | Formatted Diff | Diff
Add null check and test case. (4.19 KB, patch)
2009-10-27 03:56 PDT, Mads Ager
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mads Ager 2009-10-26 06:47:42 PDT
When reporting exceptions, we sometimes perform a string conversion on an exception object.  That string conversion can fail if an exception is thrown during conversion.  In that case an empty handle is returned.  We need to check for that.

See comment 1 and 3 of http://crbug.com/24130.
Comment 1 Mads Ager 2009-10-26 06:53:03 PDT
Created attachment 41863 [details]
Add null check.
Comment 2 Adam Barth 2009-10-26 07:54:46 PDT
Comment on attachment 41863 [details]
Add null check.

Test?
Comment 3 Mads Ager 2009-10-26 09:24:06 PDT
A test would indeed be great.  I haven't been able to reproduce this crash yet, but there are a number of crashes reported where we get into this situation.  I'll spent some more time tomorrow attempting to reproduce.
Comment 4 Adam Barth 2009-10-26 09:26:06 PDT
You can't just throw an exception in the toString?
Comment 5 Mads Ager 2009-10-26 09:29:42 PDT
Yeah, that is not the problem.  The problem is getting into this case in the code first.  I need to be in a situation where the TryCatch has no message *and* the ToString operations throws an exception.  The first part is the hard part - most of the time a TryCatch should have a message.  I need something like a stack overflow at an unfortunate time to hit this path.
Comment 6 Adam Barth 2009-10-26 09:44:46 PDT
So, I'm supposed to lean on you to write a test, but if you complain enough that it's hard to write the test, then we can go ahead with the patch anyway.

In any case, you don't need me to lecture you about testing.  :)
Comment 7 Mads Ager 2009-10-27 03:56:37 PDT
Created attachment 41942 [details]
Add null check and test case.
Comment 8 Adam Barth 2009-10-27 09:08:24 PDT
Comment on attachment 41942 [details]
Add null check and test case.

Beautiful patch.  Thanks!
Comment 9 WebKit Commit Bot 2009-10-27 09:37:15 PDT
Comment on attachment 41942 [details]
Add null check and test case.

Rejecting patch 41942 from commit-queue.

Failed to run "['/Users/eseidel/Projects/CommitQueue/WebKitTools/Scripts/svn-apply', '--reviewer', 'Adam Barth', '--force']" exit_code: 2
patching file WebCore/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file WebCore/bindings/v8/V8Utilities.cpp
patching file LayoutTests/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file LayoutTests/fast/dom/error-to-string-stack-overflow-expected.txt
Died at /Users/eseidel/Projects/CommitQueue/WebKitTools/Scripts/svn-apply line 438, <> line 109.
Comment 10 Eric Seidel (no email) 2009-10-27 09:44:29 PDT
Investigating the strange failure...
Comment 11 Eric Seidel (no email) 2009-10-27 09:46:21 PDT
    } elsif (isGit()) {
        system "git", "add", $path or die;
    }

I'm just not sure why it died yet, but I will investigate.
Comment 12 Eric Seidel (no email) 2009-10-27 10:09:25 PDT
My apologies.  False rejection.  I'm working on a fix to svn-apply right now.  bug 30826
Comment 13 Eric Seidel (no email) 2009-10-27 10:38:52 PDT
Comment on attachment 41942 [details]
Add null check and test case.

svn-apply fixed.  Trying again.
Comment 14 WebKit Commit Bot 2009-10-27 11:03:29 PDT
Comment on attachment 41942 [details]
Add null check and test case.

Clearing flags on attachment: 41942

Committed r50160: <http://trac.webkit.org/changeset/50160>
Comment 15 WebKit Commit Bot 2009-10-27 11:03:34 PDT
All reviewed patches have been landed.  Closing bug.