Bug 96567 - [V8] ScriptController::compileAndRunScript() can crash
Summary: [V8] ScriptController::compileAndRunScript() can crash
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kentaro Hara
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-12 15:12 PDT by Kentaro Hara
Modified: 2013-09-12 22:35 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.64 KB, patch)
2012-09-12 15:21 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff
Patch (2.52 KB, patch)
2012-09-18 17:55 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff
patch for landing (2.51 KB, patch)
2012-09-19 17:05 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kentaro Hara 2012-09-12 15:12:42 PDT
See chromium bug: http://code.google.com/p/chromium/issues/detail?id=146776

The root cause is the following code in ScriptSourceCode.h:

  CachedScript* cachedScript() const { return m_cachedScript.get(); }

Here m_cachedScript can be 0.
Comment 1 Kentaro Hara 2012-09-12 15:21:58 PDT
Created attachment 163715 [details]
Patch
Comment 2 Adam Barth 2012-09-12 15:40:27 PDT
Comment on attachment 163715 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163715&action=review

> Source/WebCore/bindings/v8/ScriptSourceCode.h:67
> -    CachedScript* cachedScript() const { return m_cachedScript.get(); }
> +    CachedScript* cachedScript() const { return m_cachedScript ? m_cachedScript.get() : 0; }

What does it mean for m_cachedScript to be 0?  It is held as a member, not as a pointer.
Comment 3 Kentaro Hara 2012-09-12 15:50:49 PDT
Comment on attachment 163715 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163715&action=review

>> Source/WebCore/bindings/v8/ScriptSourceCode.h:67
>> +    CachedScript* cachedScript() const { return m_cachedScript ? m_cachedScript.get() : 0; }
> 
> What does it mean for m_cachedScript to be 0?  It is held as a member, not as a pointer.

Ah, good point... maybe I was confused. More investigation is needed.
Comment 4 Kentaro Hara 2012-09-18 17:55:16 PDT
Created attachment 164640 [details]
Patch
Comment 5 Adam Barth 2012-09-19 11:24:50 PDT
Comment on attachment 164640 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164640&action=review

ok

> Source/WebCore/bindings/v8/ScriptSourceCode.cpp:53
> +    if (!scriptData.get())
> +        return nullptr;

There's no reason to call get() here.  OwnPtr has a bool operator.
Comment 6 Kentaro Hara 2012-09-19 17:05:33 PDT
Created attachment 164805 [details]
patch for landing
Comment 7 WebKit Review Bot 2012-09-19 17:41:04 PDT
Comment on attachment 164805 [details]
patch for landing

Clearing flags on attachment: 164805

Committed r129077: <http://trac.webkit.org/changeset/129077>
Comment 8 Kentaro Hara 2012-09-19 17:41:54 PDT
Comment on attachment 164640 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164640&action=review

>> Source/WebCore/bindings/v8/ScriptSourceCode.cpp:53
>> +        return nullptr;
> 
> There's no reason to call get() here.  OwnPtr has a bool operator.

Fixed. Thanks.
Comment 9 Anders Carlsson 2013-09-12 22:35:41 PDT
V8 is gone.