⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 264018 in webkit


Ignore:
Timestamp:
Jul 7, 2020, 8:20:09 AM (6 years ago)
Author:
beidson@apple.com
Message:

Fix CrashTracer reported in PDFPlugin::ByteRangeRequest::maybeComplete.
<rdar://problem/64884982> and https://bugs.webkit.org/show_bug.cgi?id=214026

Reviewed by Tim Horton.

No new tests (CrashTracer with no reproduction)

Due to the racy-ness of how PDFKit calls us on the background thread vs. what might be
happening with the main thread, sometimes the main thread is asked to handle a data
request either:

  • Before m_data is allocated or
  • After it is deallocated

In either case it's okay to just not handle it.

Despite understanding how to reproduce in theory, writing a test case has been elusive.

  • WebProcess/Plugins/PDF/PDFPlugin.mm:

(WebKit::PDFPlugin::ByteRangeRequest::maybeComplete): Null check m_data before doing anything with it.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r264016 r264018  
     12020-07-07  Brady Eidson  <beidson@apple.com>
     2
     3        Fix CrashTracer reported in PDFPlugin::ByteRangeRequest::maybeComplete.
     4        <rdar://problem/64884982> and https://bugs.webkit.org/show_bug.cgi?id=214026
     5
     6        Reviewed by Tim Horton.
     7
     8        No new tests (CrashTracer with no reproduction)
     9       
     10        Due to the racy-ness of how PDFKit calls us on the background thread vs. what might be
     11        happening with the main thread, sometimes the main thread is asked to handle a data
     12        request either:
     13        - Before m_data is allocated
     14          or
     15        - After it is deallocated
     16
     17        In either case it's okay to just not handle it.
     18
     19        Despite understanding how to reproduce in theory, writing a test case has been elusive.
     20       
     21        * WebProcess/Plugins/PDF/PDFPlugin.mm:
     22        (WebKit::PDFPlugin::ByteRangeRequest::maybeComplete): Null check m_data before doing anything with it.
     23
    1242020-07-07  Carlos Garcia Campos  <cgarcia@igalia.com>
    225
  • trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm

    r263169 r264018  
    10441044bool PDFPlugin::ByteRangeRequest::maybeComplete(PDFPlugin& plugin)
    10451045{
     1046    if (!plugin.m_data)
     1047        return false;
     1048
    10461049    if (plugin.m_streamedBytes >= m_position + m_count) {
    10471050        completeWithBytes(CFDataGetBytePtr(plugin.m_data.get()) + m_position, m_count, plugin);
     
    10561059        return true;
    10571060    }
     1061
    10581062    return false;
    10591063}
Note: See TracChangeset for help on using the changeset viewer.