Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 757068e48bcf5f86dacd0ba7211fe77ad286e64b
https://github.com/WebKit/WebKit/commit/757068e48bcf5f86dacd0ba7211fe77ad286e64b
Author: David Kilzer <[email protected]>
Date: 2026-07-24 (Fri, 24 Jul 2026)
Changed paths:
M Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig
M
Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/crypto/err/err.cc
M Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/crypto/mem.cc
M
Source/ThirdParty/libwebrtc/Source/third_party/libsrtp/crypto/include/alloc.h
M
Source/ThirdParty/libwebrtc/Source/third_party/libsrtp/crypto/kernel/alloc.c
M Source/ThirdParty/libwebrtc/Source/third_party/opus/src/celt/os_support.h
M Source/ThirdParty/libwebrtc/Source/third_party/pffft/src/pffft.c
M Source/ThirdParty/libwebrtc/Source/third_party/pffft/src/pffft.h
M Source/ThirdParty/libwebrtc/Source/third_party/yasm/libyasm/xmalloc.c
M
Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/utility/pffft_wrapper.cc
M
Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/memory/aligned_malloc.cc
M Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/memory/aligned_malloc.h
Log Message:
-----------
[libwebrtc] Adopt Typed Memory Operations in allocator wrappers
<https://bugs.webkit.org/show_bug.cgi?id=319467>
<rdar://170007132>
Reviewed by Zak Ridouh.
Enable `-Wallocator-wrappers` for the libwebrtc projects and resolve
the ten resulting warnings. The warning flags functions that directly
wrap a system allocator (`malloc`/`calloc`/`realloc`); the wrapper
hides the allocation from the compiler and prevents Typed Memory
Operations (TMO) type inference at call sites.
Resolve each wrapper using one of three strategies, picked per
wrapper based on body complexity, public-API exposure, and whether
the function is taken by-address:
- Adopt `_MALLOC_TYPED` for substantive wrappers whose `size_t`
parameter maps directly to the underlying allocation. The
compiler rewrites direct calls to a typed variant that forwards
a `malloc_type_id_t` inferred from the cast at each call site.
Applies to `srtp_crypto_alloc`, `pffft_aligned_malloc`, and
`webrtc::AlignedMalloc`.
- Convert trivial pass-through wrappers to function-like macros so
the compiler sees the underlying allocator at every call site.
Applies to `opus_alloc`, `opus_realloc`, `opus_alloc_scratch`,
`strdup_libc_malloc`, and `webrtc::AllocatePffftBuffer`.
- Suppress `-Wallocator-wrappers` for wrappers that cannot be
rewritten because the function is taken by-address. yasm's
`def_xmalloc`/`def_xcalloc`/`def_xrealloc` are only assigned to
global function pointers; `OPENSSL_malloc` is assigned to a
function pointer in `OPENSSL_vasprintf_internal`. In both cases
the rewriter cannot rewrite calls made through a function pointer
at runtime, so the original symbol must remain defined.
Enable the warning in `Base.xcconfig`, whose `WARNING_CFLAGS` every
libwebrtc target inherits via `$(inherited)`.
All WebKit-specific divergences are wrapped in
`#if defined(WEBRTC_WEBKIT_BUILD)` so future upstream resyncs land in
the `#else` branch, per the libwebrtc fork's macro contract. The
yasm pragma is unconditional because `yasm.xcconfig` does not define
`WEBRTC_WEBKIT_BUILD` (yasm is built as a build-time tool, not linked
into `libwebrtc.dylib`).
`strdup_libc_malloc` calls libc `strdup()` directly rather than
reimplementing it; upstream's MSVC deprecation and glibc/musl
feature-macro concerns do not apply on Apple platforms.
No new tests since this change is not directly testable.
* Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig:
*
Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/crypto/err/err.cc:
(strdup_libc_malloc):
* Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/crypto/mem.cc:
(OPENSSL_malloc):
* Source/ThirdParty/libwebrtc/Source/third_party/libsrtp/crypto/include/alloc.h:
* Source/ThirdParty/libwebrtc/Source/third_party/libsrtp/crypto/kernel/alloc.c:
(srtp_crypto_alloc_typed): Add.
(srtp_crypto_alloc):
* Source/ThirdParty/libwebrtc/Source/third_party/opus/src/celt/os_support.h:
* Source/ThirdParty/libwebrtc/Source/third_party/pffft/src/pffft.c:
(pffft_aligned_malloc_typed): Add.
(pffft_aligned_malloc):
* Source/ThirdParty/libwebrtc/Source/third_party/pffft/src/pffft.h:
* Source/ThirdParty/libwebrtc/Source/third_party/yasm/libyasm/xmalloc.c:
(def_xmalloc):
(def_xcalloc):
(def_xrealloc):
*
Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/utility/pffft_wrapper.cc:
(webrtc::AllocatePffftBuffer):
* Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/memory/aligned_malloc.cc:
(webrtc::AlignedMalloc_typed): Add.
(webrtc::AlignedMalloc):
* Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/memory/aligned_malloc.h:
Canonical link: https://commits.webkit.org/317915@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications