Bug 194777 - Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
Summary: Check the existence of the frame in Document::hasFrameSpecificStorageAccess()...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: John Wilander
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-02-18 08:53 PST by John Wilander
Modified: 2019-02-18 15:14 PST (History)
9 users (show)

See Also:


Attachments
Patch (1.86 KB, patch)
2019-02-18 09:16 PST, John Wilander
no flags Details | Formatted Diff | Diff
Patch (9.54 KB, patch)
2019-02-18 13:20 PST, John Wilander
no flags Details | Formatted Diff | Diff
Patch for landing (9.69 KB, patch)
2019-02-18 14:29 PST, John Wilander
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Wilander 2019-02-18 08:53:53 PST
We should check that the document has a frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess().
Comment 1 John Wilander 2019-02-18 08:54:04 PST
rdar://problem/47731945
Comment 2 John Wilander 2019-02-18 09:16:11 PST
Created attachment 362301 [details]
Patch
Comment 3 Chris Dumez 2019-02-18 10:59:02 PST
Comment on attachment 362301 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        No new tests.

I think we should try and write a test as explained offline.
Comment 4 John Wilander 2019-02-18 13:20:20 PST
Created attachment 362321 [details]
Patch
Comment 5 Geoffrey Garen 2019-02-18 14:18:52 PST
Comment on attachment 362321 [details]
Patch

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

r=me

> Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:590
> +    RELEASE_ASSERT(sessionID.isValid());

I'm not sure it's good practice to include a RELEASE_ASSERT in a fix for a null pointer dereference. That increases the chances that the crash rate will go up rather than down after the fix. For example, if we ever wanted to merge this fix onto a release branch, instead of saying "it's just a null check" we would say "it's a null check and possibly a new way to crash". That's a much more muddled risk/reward discussion.

How about an ASSERT with early return?
Comment 6 John Wilander 2019-02-18 14:21:29 PST
(In reply to Geoffrey Garen from comment #5)
> Comment on attachment 362321 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=362321&action=review
> 
> r=me

Thanks!

> > Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:590
> > +    RELEASE_ASSERT(sessionID.isValid());
> 
> I'm not sure it's good practice to include a RELEASE_ASSERT in a fix for a
> null pointer dereference. That increases the chances that the crash rate
> will go up rather than down after the fix. For example, if we ever wanted to
> merge this fix onto a release branch, instead of saying "it's just a null
> check" we would say "it's a null check and possibly a new way to crash".
> That's a much more muddled risk/reward discussion.
> 
> How about an ASSERT with early return?

I'm actually of the same opinion but Chris wants us to find other bad call sites (if there are any). Chris, care to weigh in?
Comment 7 Chris Dumez 2019-02-18 14:23:58 PST
(In reply to John Wilander from comment #6)
> (In reply to Geoffrey Garen from comment #5)
> > Comment on attachment 362321 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=362321&action=review
> > 
> > r=me
> 
> Thanks!
> 
> > > Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:590
> > > +    RELEASE_ASSERT(sessionID.isValid());
> > 
> > I'm not sure it's good practice to include a RELEASE_ASSERT in a fix for a
> > null pointer dereference. That increases the chances that the crash rate
> > will go up rather than down after the fix. For example, if we ever wanted to
> > merge this fix onto a release branch, instead of saying "it's just a null
> > check" we would say "it's a null check and possibly a new way to crash".
> > That's a much more muddled risk/reward discussion.
> > 
> > How about an ASSERT with early return?
> 
> I'm actually of the same opinion but Chris wants us to find other bad call
> sites (if there are any). Chris, care to weigh in?

I am OK with ASSERT() with early return. I actually thought this is what we eventually agreed on offline but I probably wasn't clear I changed my mind.
Comment 8 John Wilander 2019-02-18 14:24:51 PST
(In reply to Chris Dumez from comment #7)
> (In reply to John Wilander from comment #6)
> > (In reply to Geoffrey Garen from comment #5)
> > > Comment on attachment 362321 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=362321&action=review
> > > 
> > > r=me
> > 
> > Thanks!
> > 
> > > > Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:590
> > > > +    RELEASE_ASSERT(sessionID.isValid());
> > > 
> > > I'm not sure it's good practice to include a RELEASE_ASSERT in a fix for a
> > > null pointer dereference. That increases the chances that the crash rate
> > > will go up rather than down after the fix. For example, if we ever wanted to
> > > merge this fix onto a release branch, instead of saying "it's just a null
> > > check" we would say "it's a null check and possibly a new way to crash".
> > > That's a much more muddled risk/reward discussion.
> > > 
> > > How about an ASSERT with early return?
> > 
> > I'm actually of the same opinion but Chris wants us to find other bad call
> > sites (if there are any). Chris, care to weigh in?
> 
> I am OK with ASSERT() with early return. I actually thought this is what we
> eventually agreed on offline but I probably wasn't clear I changed my mind.

OK, I will fix this and land. Thanks, both of you.
Comment 9 John Wilander 2019-02-18 14:29:44 PST
Created attachment 362335 [details]
Patch for landing
Comment 10 WebKit Commit Bot 2019-02-18 15:14:03 PST
Comment on attachment 362335 [details]
Patch for landing

Clearing flags on attachment: 362335

Committed r241743: <https://trac.webkit.org/changeset/241743>
Comment 11 WebKit Commit Bot 2019-02-18 15:14:05 PST
All reviewed patches have been landed.  Closing bug.