Use after free in Skia (CVE-2026-15774)
A use-after-free occurs in Skia's SlugImpl::MakeFromBuffer due to the undefined destruction order of a std::tuple. An attacker could potentially trigger a crash or memory corruption by supplying a crafted buffer that reaches the early return path.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 12 days
This UAF was discovered during the MiraclePtr rewrite project. It is blocking it, and is also a pre-existing bug, maybe a vulnerability.
Reproducer:
bin/gn gen out/asan --args='is_debug=true extra_cflags=["-fsanitize=address", "-fno-omit-frame-pointer"] extra_ldflags=["-fsanitize=address"]'
autoninja -C out/asan dm
xvfb-run out/asan/dm --match Slug_b520571816
Description
The C++ destruction order of std::tuple is not defined. In practise, clang will destroy <0>, <1>, and <2> and GCC will destroy in the opposite direction: <2>, <1>, <0>.
SubRunAllocator::AllocateClassMemoryAndArena returns:
std::tuple<SubRunInitializer<T>, int, SubRunAllocator>
There is an early return causing memory issues:
Due to the destruction order of std::tuple:
SubRunInitializer(index 0) is destructed first. Its destructor calls::operator deleteon the backing memory.SubRunAllocator(index 2) is destructed second. Its destructor (~BagOfBytes) attempts to accessfEndByteto free any heap-allocated blocks. SincefEndBytepoints to a location inside the backing memory that was just freed by theSubRunInitializer, this results in a Use-After-Free.
ASAN Report
=================================================================
==2941250==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d2d7c8476e0 at pc 0x55906e06b3a0 bp 0x7fffffff9730 sp 0x7fffffff9728
READ of size 8 at 0x7d2d7c8476e0 thread T0
#0 0x55906e06b39f in sktext::gpu::BagOfBytes::~BagOfBytes() ../../src/text/gpu/SubRunAllocator.cpp:39
#1 0x55906e06af73 in sktext::gpu::SubRunAllocator::~SubRunAllocator() ../../src/text/gpu/SubRunAllocator.h:211
#2 0x5590711e33b5 in std::_Head_base<2ul, sktext::gpu::SubRunAllocator, false>::~_Head_base() /usr/include/c++/15/tuple:200
#3 0x5590711e33d1 in std::_Tuple_impl<2ul, sktext::gpu::SubRunAllocator>::~_Tuple_impl() /usr/include/c++/15/tuple:546
#4 0x5590711e33ed in std::_Tuple_impl<1ul, int, sktext::gpu::SubRunAllocator>::~_Tuple_impl() /usr/include/c++/15/tuple:281
#5 0x5590711e3435 in std::_Tuple_impl<0ul, sktext::gpu::SubRunInitializer<sktext::gpu::SlugImpl>, int, sktext::gpu::SubRunAllocator>::~_Tuple_impl() /usr/include/c++/15/tuple:281
#6 0x5590711e3451 in std::tuple<sktext::gpu::SubRunInitializer<sktext::gpu::SlugImpl>, int, sktext::gpu::SubRunAllocator>::~tuple() /usr/include/c++/15/tuple:833
#7 0x5590711e2429 in sktext::gpu::SlugImpl::MakeFromBuffer(SkReadBuffer&, SkStrikeClient const*) ../../src/text/gpu/SlugImpl.cpp:67
0x7d2d7c8476e0 is located 480 bytes inside of 504-byte region [0x7d2d7c847500,0x7d2d7c8476f8)
freed by thread T0 here:
#0 0x7fdd7e11b653 in operator delete(void*) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:143
#1 0x5590711e3a07 in sktext::gpu::SubRunInitializer<sktext::gpu::SlugImpl>::~SubRunInitializer() ../../src/text/gpu/SubRunAllocator.h:193
#2 0x5590711e3409 in std::_Head_base<0ul, sktext::gpu::SubRunInitializer<sktext::gpu::SlugImpl>, false>::~_Head_base() /usr/include/c++/15/tuple:200
previously allocated by thread T0 here:
#0 0x7fdd7e11abbb in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:86
#1 0x5590711e38ca in std::tuple<sktext::gpu::SubRunInitializer<sktext::gpu::SlugImpl>, int, sktext::gpu::SubRunAllocator> sktext::gpu::SubRunAllocator::AllocateClassMemoryAndArena<sktext::gpu::SlugImpl>(int) ../../src/text/gpu/SubRunAllocator.h:247
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The C++ standard does not define the destruction order of std::tuple elements, and the code relies on a specific order that is not guaranteed, leading to a use-after-free when the tuple is destroyed after an early return.
Impact
This could lead to a crash or potentially memory corruption, but the text does not confirm exploitability beyond the ASAN report.
What the attacker needed
Crafted buffer to trigger early return
How it was found
- Build Skia with AddressSanitizer enabled using the provided GN arguments.
- Run the dm test binary with the specific test case Slug_b520571816.
- Observe the AddressSanitizer report showing a heap-use-after-free in BagOfBytes destructor.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A use-after-free is a bug where a program frees a block of memory and then later tries to read or write to it. In this case, two objects inside a tuple are destroyed in an order that leaves one object pointing to memory that the other object already freed. This can cause crashes or, in some cases, let an attacker control what happens.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.