Bug 49342

Summary: [Qt] QWebScriptWorld::world() may crash
Product: WebKit Reporter: Yi Shen <max.hong.shen>
Component: WebKit QtAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Minor CC: commit-queue, kling
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
first try
none
second try none

Yi Shen
Reported 2010-11-10 13:49:11 PST
It might be trivial but we'd better check the value of the private data in the QWebScriptWorld::world() to prevent the possible crash -- 'd' may have an empty data if USE(JSC) is undefined for some platform. QWebScriptWorld::QWebScriptWorld() { #if USE(JSC) // d can have an empty data if this macro fails d = new QWebScriptWorldPrivate(ScriptController::createWorld()); #endif }
Attachments
first try (969 bytes, patch)
2010-11-10 13:52 PST, Yi Shen
no flags
second try (990 bytes, patch)
2010-11-11 03:07 PST, Yi Shen
no flags
Yi Shen
Comment 1 2010-11-10 13:52:18 PST
Created attachment 73536 [details] first try
Kenneth Rohde Christiansen
Comment 2 2010-11-11 01:34:23 PST
Comment on attachment 73536 [details] first try View in context: https://bugs.webkit.org/attachment.cgi?id=73536&action=review > WebKit/qt/Api/qwebscriptworld.cpp:53 > + return d.data() ? d->world.get() : NULL; huh? how does world depend on data() ? Also we do not use NULL in C++ code.
Yi Shen
Comment 3 2010-11-11 03:07:43 PST
Created attachment 73593 [details] second try
Yi Shen
Comment 4 2010-11-11 03:10:32 PST
(In reply to comment #2) > (From update of attachment 73536 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=73536&action=review > > > WebKit/qt/Api/qwebscriptworld.cpp:53 > > + return d.data() ? d->world.get() : NULL; > > huh? how does world depend on data() ? Also we do not use NULL in C++ code. Thanks, you are right. I updated my patch, which returns 0 when the internal pointer to the shared data object is not null.
Andreas Kling
Comment 5 2010-11-11 03:11:25 PST
Comment on attachment 73593 [details] second try This is a purely artificial problem since we always build with USE(JSC) and the V8 port will most likely require large changes to QWebScriptWorld anyway. That said, I don't see any harm in adding this check. r=me
WebKit Commit Bot
Comment 6 2010-11-11 06:51:01 PST
Comment on attachment 73593 [details] second try Clearing flags on attachment: 73593 Committed r71818: <http://trac.webkit.org/changeset/71818>
WebKit Commit Bot
Comment 7 2010-11-11 06:51:07 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.