Changeset 250934 in webkit


Ignore:
Timestamp:
Oct 9, 2019 2:29:19 PM (4 years ago)
Author:
aestes@apple.com
Message:

[Cocoa] IPC::decode should gracefully handle a nil allowed class
https://bugs.webkit.org/show_bug.cgi?id=202753

Reviewed by Geoffrey Garen.

If IPC::decode is called with a nil allowed class, an NSInvalidArgumentException will be
thrown when trying to create an NSArray literal with a nil value. Depending on who calls
IPC::decode, this exception might or might not be caught, leading to dropped messages or
crashes.

One case of this happening is tracked by rdar://problem/55839467. In this case, the nil
allowed class was due to a build misconfiguration, and the exception caused the UI process
to not respond to a synchronous IPC message, hanging the WebContent process.

rdar://problem/55839467 was resolved by fixing the build misconfiguration, but this patch
improves IPC::decode so that a nil allowed class results in a message decoding failure
rather than a maybe-caught NSException.

  • Shared/Cocoa/ArgumentCodersCocoa.h:

(IPC::decode):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r250904 r250934  
     12019-10-09  Andy Estes  <aestes@apple.com>
     2
     3        [Cocoa] IPC::decode should gracefully handle a nil allowed class
     4        https://bugs.webkit.org/show_bug.cgi?id=202753
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        If IPC::decode is called with a nil allowed class, an NSInvalidArgumentException will be
     9        thrown when trying to create an NSArray literal with a nil value. Depending on who calls
     10        IPC::decode, this exception might or might not be caught, leading to dropped messages or
     11        crashes.
     12
     13        One case of this happening is tracked by rdar://problem/55839467. In this case, the nil
     14        allowed class was due to a build misconfiguration, and the exception caused the UI process
     15        to not respond to a synchronous IPC message, hanging the WebContent process.
     16
     17        rdar://problem/55839467 was resolved by fixing the build misconfiguration, but this patch
     18        improves IPC::decode so that a nil allowed class results in a message decoding failure
     19        rather than a maybe-caught NSException.
     20
     21        * Shared/Cocoa/ArgumentCodersCocoa.h:
     22        (IPC::decode):
     23
    1242019-10-09  youenn fablet  <youenn@apple.com>
    225
  • trunk/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h

    r242930 r250934  
    8585Optional<RetainPtr<T>> decode(Decoder& decoder, Class allowedClass)
    8686{
    87     return decode<T>(decoder, @[ allowedClass ]);
     87    return decode<T>(decoder, allowedClass ? @[ allowedClass ] : @[ ]);
    8888}
    8989
Note: See TracChangeset for help on using the changeset viewer.