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

Changeset 280837 in webkit


Ignore:
Timestamp:
Aug 10, 2021, 2:31:51 AM (5 years ago)
Author:
Adrian Perez de Castro
Message:

Merge r274158 - [IPC Hardening] SandboxExtension::HandleArray IPC decoder should not call Vector::resize()
https://bugs.webkit.org/show_bug.cgi?id=222977
<rdar://problem/75218451>

Reviewed by Anders Carlsson.

SandboxExtension::HandleArray IPC decoder should not call Vector::resize() with an untrusted size
coming from IPC. Instead, call Vector::append(), like the Vector IPC decoder does.

  • Shared/Cocoa/SandboxExtensionCocoa.mm:

(WebKit::SandboxExtension::HandleArray::append):
(WebKit::SandboxExtension::HandleArray::decode):

  • Shared/SandboxExtension.h:

(WebKit::SandboxExtension::append):

Location:
releases/WebKitGTK/webkit-2.32/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog

    r280836 r280837  
     12021-03-09  Chris Dumez  <cdumez@apple.com>
     2
     3        [IPC Hardening] SandboxExtension::HandleArray IPC decoder should not call Vector::resize()
     4        https://bugs.webkit.org/show_bug.cgi?id=222977
     5        <rdar://problem/75218451>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        SandboxExtension::HandleArray IPC decoder should not call Vector::resize() with an untrusted size
     10        coming from IPC. Instead, call Vector::append(), like the Vector IPC decoder does.
     11
     12        * Shared/Cocoa/SandboxExtensionCocoa.mm:
     13        (WebKit::SandboxExtension::HandleArray::append):
     14        (WebKit::SandboxExtension::HandleArray::decode):
     15        * Shared/SandboxExtension.h:
     16        (WebKit::SandboxExtension::append):
     17
    1182021-03-09  Chris Dumez  <cdumez@apple.com>
    219
  • releases/WebKitGTK/webkit-2.32/Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm

    r265303 r280837  
    188188}
    189189
     190void SandboxExtension::HandleArray::append(Handle&& handle)
     191{
     192    m_data.append(WTFMove(handle));
     193}
     194
    190195SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t i)
    191196{
     
    218223    if (!size)
    219224        return WTF::nullopt;
     225
    220226    SandboxExtension::HandleArray handles;
    221     handles.allocate(*size);
    222227    for (size_t i = 0; i < *size; ++i) {
    223228        Optional<SandboxExtension::Handle> handle;
     
    225230        if (!handle)
    226231            return WTF::nullopt;
    227         handles[i] = WTFMove(*handle);
     232        handles.append(WTFMove(*handle));
    228233    }
    229234    return WTFMove(handles);
  • releases/WebKitGTK/webkit-2.32/Source/WebKit/Shared/SandboxExtension.h

    r263288 r280837  
    9191        ~HandleArray();
    9292        void allocate(size_t);
     93        void append(Handle&&);
    9394        Handle& operator[](size_t i);
    9495        Handle& at(size_t i) { return operator[](i); }
     
    150151inline SandboxExtension::HandleArray::~HandleArray() { }
    151152inline void SandboxExtension::HandleArray::allocate(size_t) { }
     153inline void SandboxExtension::HandleArray::append(Handle&&) { }
    152154inline size_t SandboxExtension::HandleArray::size() const { return 0; }   
    153155inline const SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) const { return m_emptyHandle; }
Note: See TracChangeset for help on using the changeset viewer.