Bug 64155 - Web Inspector: typing undefined = 1 in console crashes browser
Summary: Web Inspector: typing undefined = 1 in console crashes browser
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Yury Semikhatsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-08 02:23 PDT by Yury Semikhatsky
Modified: 2011-07-08 03:16 PDT (History)
10 users (show)

See Also:


Attachments
Patch (5.78 KB, patch)
2011-07-08 02:54 PDT, Yury Semikhatsky
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yury Semikhatsky 2011-07-08 02:23:59 PDT
What steps will reproduce the problem?
1. Open the JavaScript console (Ctrl-Shift-J)
2. Type "undefined = this" without the quotes
3. Type "undefined = 1" without the quotes

Original Chromium bug: crbug.com/88414
Comment 1 Yury Semikhatsky 2011-07-08 02:41:36 PDT
It is not necessarily undefined=this; right hand side value may be any object with cyclic reference, so the steps could be changed to:

1. Open the JavaScript console (Ctrl-Shift-J)
2. Type "var x = {a:1}; x.self = x; undefined = x;" without the quotes
3. Type "unknownVar" without the quotes
Comment 2 Yury Semikhatsky 2011-07-08 02:54:32 PDT
Created attachment 100098 [details]
Patch
Comment 3 Pavel Feldman 2011-07-08 03:10:05 PDT
Comment on attachment 100098 [details]
Patch

How do we make sure undefined is not used? Declare "var trueUndefined" in the top of the file?
Comment 4 Alexander Pavlov (apavlov) 2011-07-08 03:12:52 PDT
Comment on attachment 100098 [details]
Patch

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

> Source/WebCore/inspector/InjectedScriptSource.js:456
> +    // Avoid explicit assignment to undefined as its value can be overriden (see crbug.com/88414).

..overridden..
Comment 5 Yury Semikhatsky 2011-07-08 03:13:30 PDT
Committed r90614: <http://trac.webkit.org/changeset/90614>
Comment 6 Yury Semikhatsky 2011-07-08 03:14:42 PDT
(In reply to comment #3)
> (From update of attachment 100098 [details])
> How do we make sure undefined is not used? Declare "var trueUndefined" in the top of the file?

I don't see a good way to achieve this without affecting the application that decided to modify undefined value.
Comment 7 Yury Semikhatsky 2011-07-08 03:16:01 PDT
(In reply to comment #6)
> (In reply to comment #3)
> > (From update of attachment 100098 [details] [details])
> > How do we make sure undefined is not used? Declare "var trueUndefined" in the top of the file?
> 
> I don't see a good way to achieve this without affecting the application that decided to modify undefined value.

We could emulate worst-case conditions in all tests(override JSON object, undefined value and whatever we need).