Skip to content
Memory corruption Advisory Advanced CVE-2026-8558

Out of bounds write in Fonts (CVE-2026-8558)

A crafted font with multiple STCH groups causes an integer overflow in HarfBuzz's apply_stch function, leading to a heap out-of-bounds write. An attacker could crash the renderer by serving the font and Arabic text on any website.

Matej Smycka Follow

Originally disclosed on Chrome VRP

Bounty$10,000 High View original
  • Fix shipped in 27 days

Report description

apply_stch uint32 accumulation OOB write (Chromium renderer SEGV)


Bug location

Where do you want to report your vulnerability?

Chrome VRP – Report security issues affecting the Chrome browser. See program rules

Which URL (or repository) have you found the vulnerability in?

https://chromium.googlesource.com/chromium/src/third_party/+/refs/heads/main


The problem

Please describe the technical details of the vulnerability

Summary

In HarfBuzz apply_stch (src/hb-ot-shaper-arabic.cc), the MEASURE pass accumulates extra_glyphs_needed (uint32) across multiple STCH groups in one buffer. The overflow-detected break exits only the inner per-group loop; the outer step loop continues to CUT, which walks all groups and writes the full (non-wrapped) number of entries into a buffer sized by the partial pre-overflow value. Result: heap OOB write.

Chromium is reachable because Blink feeds an entire Arabic script run to hb_shape() with no fragment cap (Firefox has MAX_SHAPING_LENGTH=32760).

Repro

Artifacts (this directory):

  • stch_of3.ttf – 844 B crafted font; stch → beh → [tile_f, tile_r]
  • poc.html – @font-face loads the font, lays out 16,909,322 × BEH ALEF pairs in one RTL run.

Serve and point an ASan Chromium at the page:

Shell
python3 -m http.server 8899 &
ASAN_OPTIONS="log_path=/tmp/asan.log:handle_segv=1:allow_user_segv_handler=0:detect_leaks=0:symbolize=1" \
  ~/asan/asan-chromium/content_shell --no-sandbox --disable-hang-monitor \
  http://127.0.0.1:8899/poc.html

# takes 10-60s

Renderer SEGVs after page load; ASan log at /tmp/asan.log.<pid>.

Root cause

src/hb-ot-shaper-arabic.cc MEASURE block (pre-fix):

C
if (unlikely (hb_unsigned_mul_overflows (n_copies, n_repeating, &added_glyphs) ||
              hb_unsigned_add_overflows (extra_glyphs_needed, added_glyphs,
                                         &extra_glyphs_needed)))
  break;            // exits inner loop only

After the break, the outer if (step == MEASURE) { buffer->ensure (…); } uses the partial extra_glyphs_needed → small allocation → CUT OOB.

Credit

Matej Smycka

Impact analysis

Any website the victim visits can trigger this bug by serving a crafted font and some Arabic text. It reliably crashes the renderer tab on 64bit as the write lands far outside the process memory. 32bit would land into the process. The 64bit is unlikely to be exploited as controlled write, however it may be possible.


The cause

What version of Chrome have you found the security issue in?

148.0.7750.0 [ASan content_shell, Linux x86_64]

Is the security issue related to a crash?

No, it is not related to a crash.

Choose the type of vulnerability

Memory Corruption (in a sandboxed process)

How would you like to be publicly acknowledged for your report?

Matej Smycka

The original report as published on the Chromium issue tracker, by Matej Smycka. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

HarfBuzz is the shaping engine that turns a run of Unicode text plus a font into positioned glyphs. Chromium's Blink uses it through hb_shape() to lay out text, including Arabic script, where contextual forms and features such as stch (stretching) are applied. The stch feature lets a font substitute a glyph with a number of copies of a repeating glyph, so a single character can be stretched across a span.

The vulnerability described here is an out-of-bounds write in HarfBuzz's apply_stch function in src/hb-ot-shaper-arabic.cc, reachable from any web page that supplies a crafted font and Arabic text. It was reported to the Chrome Vulnerability Reward Program, since the affected code ships inside the Chrome renderer, and it is tracked as CVE-2026-8558. The upstream advisory is GHSA-5xrh-8c3h-7c49 and the upstream fix is pull request 5929 in the HarfBuzz repository.

Setup

The issue was found in Chrome 148.0.7750.0, specifically an ASan build of content_shell on Linux x86_64. The reporter worked against the Chromium source tree at:

Text
https://chromium.googlesource.com/chromium/src/third_party/+/refs/heads/main

Two artefacts were prepared in the working directory:

  • stch_of3.ttf, an 844-byte crafted font whose stch feature maps beh to [tile_f, tile_r].
  • poc.html, a page that loads the font through @font-face and lays out 16,909,322 BEH ALEF pairs in a single right-to-left run.

Finding it

The reporter traced the problem to the MEASURE pass of apply_stch. That pass walks the STCH groups in the buffer and accumulates extra_glyphs_needed, a uint32, across all of them. When an overflow is detected, the code breaks out, but only out of the inner per-group loop. The outer step loop then continues into the CUT pass, which walks every group and writes the full, non-wrapped number of entries into a buffer that was sized using the partial, pre-overflow value. The result is a heap out-of-bounds write.

What makes this reachable from the web in Chromium, and not in every browser, is that Blink hands an entire Arabic script run to hb_shape() without a fragment cap. The report notes that Firefox has MAX_SHAPING_LENGTH=32760, which the report cites as the difference from Blink.. The crafted font and the very long run of BEH ALEF pairs are what drive extra_glyphs_needed past its limit.

Exploitation

Step 1: serve the page and the font

Start a local HTTP server in the directory holding poc.html and stch_of3.ttf:

Shell
python3 -m http.server 8899 &

This makes the page available at http://[redacted]:8899/poc.html so the test browser can load it.

Step 2: launch the ASan build against the page

Shell
ASAN_OPTIONS="log_path=/tmp/asan.log:handle_segv=1:allow_user_segv_handler=0:detect_leaks=0:symbolize=1" \
  ~/asan/asan-chromium/content_shell --no-sandbox --disable-hang-monitor \
  http://[redacted]:8899/poc.html

The ASAN_OPTIONS string writes the report to /tmp/asan.log.<pid>, keeps the segv handler in place, disables leak detection and enables symbolisation. --no-sandbox and --disable-hang-monitor keep the test harness out of the way while the long layout runs. The report notes the run takes 10 to 60 seconds.

Step 3: observe the crash

The renderer SEGVs after page load, and the ASan log is written to /tmp/asan.log.<pid>. The write lands far outside the process memory on 64-bit, and the renderer tab crashes reliably.

Root cause

The pre-fix MEASURE block looked like this:

C
if (unlikely (hb_unsigned_mul_overflows (n_copies, n_repeating, &added_glyphs) ||
              hb_unsigned_add_overflows (extra_glyphs_needed, added_glyphs,
                                         &extra_glyphs_needed)))
  break;            // exits inner loop only

The break leaves only the inner per-group loop. Control returns to the outer step loop, which proceeds to the CUT pass. The buffer sizing that follows the MEASURE pass uses the partial extra_glyphs_needed value, so the allocation is too small for the number of entries the CUT pass then writes. The comment in the report spells out the consequence: after the break, the outer if (step == MEASURE) { buffer->ensure (…); } uses the partial extra_glyphs_needed, producing a small allocation and an out-of-bounds write in CUT.

The existing overflow checks (hb_unsigned_mul_overflows and hb_unsigned_add_overflows) do detect the arithmetic overflow, but the control flow does not propagate that detection out of the outer loop, so the defence is defeated by the loop structure rather than by a missing check.

Impact

Any website the victim visits can trigger the bug by serving a crafted font together with some Arabic text. On 64-bit builds the write lands far outside the process memory and reliably crashes the renderer tab. On 32-bit builds the write would land inside the process. The reporter judges that a controlled write on 64-bit is unlikely, though possibly achievable. The vulnerability is classified as memory corruption in a sandboxed process.

Fix

The report references HarfBuzz pull request 5929 as the upstream fix, alongside advisory GHSA-5xrh-8c3h-7c49. The report does not describe the contents of the patch; the defect it addresses is the break that exits only the inner loop, leaving the outer step loop to continue into CUT with a partial extra_glyphs_needed.

Variants to test

  1. Other shapers with accumulation counters: look for uint32 or size_t accumulators that are summed across groups or runs and then used to size a buffer, and check whether an overflow guard exits only an inner loop. A positive result is a guard that fires but is followed by a write pass using the pre-overflow value.
  2. Other browsers and text stacks: check whether the caller caps the length of a shaping run. A positive result is a caller that passes an unbounded run to hb_shape() where the shaping code has an overflow path, as Blink does here.
  3. Other OpenType features that expand one glyph into many (stch is one; substitution and multiple-substitution features are others): craft a font where the expansion count is attacker-controlled and drive it with a long run. A positive result is an allocation sized from a partial count followed by a write of the full count.
  4. 32-bit builds: repeat the same page on a 32-bit renderer. A positive result is a write that stays inside the process address space, which is the more interesting case for exploitation than the 64-bit crash.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

A web browser has to turn text into shapes on screen. For most languages that is simple, but Arabic is not: the same letter can look different depending on where it sits in a word, and some letters can be stretched to fill space. The browser does not do this work itself. It hands the text and a font file to a helper library called HarfBuzz, which returns a list of drawn shapes with positions. This report is about a bug in HarfBuzz that a web page can trigger, and that crashes the browser tab.

The bug is a memory corruption bug. To understand that, imagine a hotel where each guest is given a room number, and the hotel keeps a list of which room belongs to whom. If a guest is accidentally given a room number that is not on the list, they may walk into a room that belongs to someone else, or into a wall. Computer memory works the same way: a program reserves a block of memory and writes data into it, and if it writes past the end of the block, it overwrites whatever comes next. That is called an out-of-bounds write. Sometimes the program is lucky and the write lands in empty space, and the program crashes. Sometimes it lands on something important, and an attacker can take control. This report describes the first kind: a reliable crash.

The bug lives in a HarfBuzz feature called stch, short for stretching. A font can say: instead of drawing this one letter, draw a number of copies of a repeating shape, so the letter stretches across a wider space. HarfBuzz counts how many extra shapes it will need, reserves memory for them, and then fills that memory. The counting step and the filling step disagree when the count gets very large, and the filling step writes more than was reserved.

Chrome is affected because its page-rendering engine, Blink, passes a whole run of Arabic text to HarfBuzz in one go, with no limit on length. Firefox limits the length of a shaping run to 32760 characters, so the count never gets large enough to overflow. Chrome has no such limit, so a page can supply a very long run of Arabic text plus a specially built font, and push the counter past its maximum.

The report was filed with the Chrome Vulnerability Reward Program, which pays researchers for finding security bugs in Chrome. A CVE is a public catalogue number given to a known security flaw so people can refer to it unambiguously. The report references HarfBuzz pull request 5929 as the upstream fix, and the upstream advisory is GHSA-5xrh-8c3h-7c49. An advisory is a public notice describing a security problem and its fix. A pull request is a proposed change to a code repository, which maintainers review and merge.

Context

HarfBuzz is the shaping engine. Shaping means taking a string of text plus a font file and producing the actual drawn shapes, called glyphs, with their positions. A glyph is one drawn shape: the letter A is a glyph, and so is one particular form of the Arabic letter beh. A font is a file that contains those shapes and rules about when to use which one.

Chromium's Blink calls HarfBuzz through a function named hb_shape(). Blink is the part of Chrome that turns HTML and CSS into a page on screen. When it meets text, it collects a run of characters in the same script and font, and asks HarfBuzz to shape it. For Arabic, HarfBuzz applies contextual forms (the same letter drawn differently depending on its neighbours) and features such as stch.

The stch feature lets a font replace one glyph with several copies of a repeating glyph. The font says which glyph to repeat and how many times, and HarfBuzz produces the stretched result. This is what makes a single character able to span a wider area.

The vulnerability is an out-of-bounds write in HarfBuzz's apply_stch function, in the file src/hb-ot-shaper-arabic.cc. It is reachable from any web page that supplies a crafted font and Arabic text. It was reported to the Chrome Vulnerability Reward Program because the affected code ships inside the Chrome renderer. The renderer is the part of the browser that draws pages, and it runs in a sandbox, which is a restricted environment that limits what a compromised renderer can do to the rest of the machine.

Setup

The issue was found in Chrome 148.0.7750.0, specifically an ASan build of content_shell on Linux x86_64. ASan stands for AddressSanitizer, a tool built into a special version of the browser that watches memory accesses and reports any that go out of bounds, with a detailed log. content_shell is a bare-bones browser used for testing, without the normal Chrome interface. Linux x86_64 means a 64-bit Linux system.

The reporter worked against the Chromium source tree at:

Text
https://chromium.googlesource.com/chromium/src/third_party/+/refs/heads/main

This is a URL to a code repository. chromium.googlesource.com hosts the Chromium source code, src/third_party is the folder where third-party libraries such as HarfBuzz live, and refs/heads/main means the main development branch. The reporter is pointing at the exact code being tested, so anyone can find the same file.

Two artefacts were prepared in the working directory. An artefact here just means a file used in the test.

  • stch_of3.ttf, an 844-byte crafted font whose stch feature maps beh to [tile_f, tile_r]. In plain terms: a tiny font file, built on purpose, that tells HarfBuzz to stretch the Arabic letter beh using two repeating shapes called tile_f and tile_r.
  • poc.html, a page that loads the font through @font-face and lays out 16,909,322 BEH ALEF pairs in a single right-to-left run. @font-face is the CSS rule that tells the browser to download and use a font file from a URL. A right-to-left run is a stretch of text written in a script that reads right to left, such as Arabic. BEH ALEF is a pair of Arabic letters. The page repeats that pair millions of times, which is what drives the counter over its limit.

Finding it

The reporter traced the problem to the MEASURE pass of apply_stch. HarfBuzz works in passes. The MEASURE pass walks through the groups of glyphs in the buffer and counts how many extra glyphs will be needed, storing the total in a variable called extra_glyphs_needed. The CUT pass then actually writes those glyphs into memory. A buffer here is a block of memory reserved to hold the glyphs.

The variable extra_glyphs_needed is a uint32, which is an unsigned 32-bit integer: a whole number that cannot be negative and can hold values from 0 up to 4,294,967,295. If you add past that maximum, the number wraps around to a small value, like a car odometer rolling over. That wrap is called an integer overflow, and it is dangerous because the program believes the small number it now sees.

When the MEASURE pass detects that an overflow would happen, the code breaks out of the loop. But it only breaks out of the inner per-group loop. The outer step loop then continues into the CUT pass, which walks every group and writes the full, non-wrapped number of entries into a buffer that was sized using the partial, pre-overflow value. The result is a heap out-of-bounds write. The heap is the general pool of memory a program uses for data it creates while running, as opposed to the stack, which is used for short-lived function data.

What makes this reachable from the web in Chromium, and not in every browser, is that Blink hands an entire Arabic script run to hb_shape() without a fragment cap. A fragment cap is a limit on how many characters can be shaped in one call. The report notes that Firefox has MAX_SHAPING_LENGTH=32760, which prevents a run from growing large enough to overflow the counter. The crafted font and the very long run of BEH ALEF pairs are what drive extra_glyphs_needed past its limit.

Exploitation

Step 1: serve the page and the font

Start a local HTTP server in the directory holding poc.html and stch_of3.ttf:

Shell
python3 -m http.server 8899 &

Line by line: python3 runs the Python interpreter. -m http.server tells Python to run its built-in web server module. 8899 is the port number, the numbered door on the machine where the server listens. The trailing & puts the command in the background so the terminal stays usable.

This makes the page available at http://[redacted]:8899/poc.html so the test browser can load it. [redacted] is the loopback address, meaning this machine itself, so the page is served locally and never leaves the computer.

Step 2: launch the ASan build against the page

Shell
ASAN_OPTIONS="log_path=/tmp/asan.log:handle_segv=1:allow_user_segv_handler=0:detect_leaks=0:symbolize=1" \
  ~/asan/asan-chromium/content_shell --no-sandbox --disable-hang-monitor \
  http://[redacted]:8899/poc.html

Line by line: ASAN_OPTIONS is an environment variable, a setting passed to the program before it starts. Its value is a colon-separated list of options. log_path=/tmp/asan.log writes the report to /tmp/asan.log.<pid>, where <pid> is the process ID, a number the operating system assigns to each running program. handle_segv=1 keeps the segv handler in place. A segv, short for segmentation fault, is the operating system's signal that a program touched memory it should not have. allow_user_segv_handler=0 stops the program from installing its own handler for that signal, so ASan's handler stays in charge. detect_leaks=0 disables leak detection, which looks for memory that was reserved and never freed; it is turned off here to keep the log focused. symbolize=1 turns raw memory addresses into readable function and file names in the log.

The backslash at the end of a line continues the command on the next line, purely for readability. ~/asan/asan-chromium/content_shell is the path to the test browser binary, where ~ means the user's home directory. --no-sandbox and --disable-hang-monitor keep the test harness out of the way while the long layout runs: the first turns off the sandbox, which would otherwise restrict the test, and the second stops the browser from killing a page that appears frozen. The last argument is the URL to load. The report notes the run takes 10 to 60 seconds.

Step 3: observe the crash

The renderer SEGVs after page load, and the ASan log is written to /tmp/asan.log.<pid>. The write lands far outside the process memory on 64-bit, and the renderer tab crashes reliably. In other words, the out-of-bounds write goes so far past the reserved block that it hits memory the process does not own at all, and the operating system stops the process immediately.

Root cause

The pre-fix MEASURE block looked like this:

C
if (unlikely (hb_unsigned_mul_overflows (n_copies, n_repeating, &added_glyphs) ||
              hb_unsigned_add_overflows (extra_glyphs_needed, added_glyphs,
                                         &extra_glyphs_needed)))
  break;            // exits inner loop only

Line by line: if (unlikely (...)) is a branch that the compiler is told is unlikely to be taken, so it can arrange the fast path first. hb_unsigned_mul_overflows (n_copies, n_repeating, &added_glyphs) asks whether multiplying n_copies by n_repeating would overflow an unsigned integer, and if not, stores the product in added_glyphs. hb_unsigned_add_overflows (extra_glyphs_needed, added_glyphs, &extra_glyphs_needed) asks whether adding added_glyphs to the running total would overflow, and if not, updates the total. The || means either check being true is enough. break; leaves the loop. The comment says it all: it exits the inner loop only.

The break leaves only the inner per-group loop. Control returns to the outer step loop, which proceeds to the CUT pass. The buffer sizing that follows the MEASURE pass uses the partial extra_glyphs_needed value, so the allocation is too small for the number of entries the CUT pass then writes. The comment in the report spells out the consequence: after the break, the outer if (step == MEASURE) { buffer->ensure (…); } uses the partial extra_glyphs_needed, producing a small allocation and an out-of-bounds write in CUT. buffer->ensure (…) is the call that reserves enough memory for the glyphs.

The existing overflow checks (hb_unsigned_mul_overflows and hb_unsigned_add_overflows) do detect the arithmetic overflow, but the control flow does not propagate that detection out of the outer loop, so the defence is defeated by the loop structure rather than by a missing check. In everyday terms: the alarm goes off, but the person who hears it only leaves one room, while the dangerous work continues in the next room.

Impact

Any website the victim visits can trigger the bug by serving a crafted font together with some Arabic text. On 64-bit builds the write lands far outside the process memory and reliably crashes the renderer tab. On 32-bit builds the write would land inside the process. The reporter judges that a controlled write on 64-bit is unlikely, though possibly achievable. A controlled write means an attacker can choose exactly what value goes where, which is the step that turns a crash into a takeover. The vulnerability is classified as memory corruption in a sandboxed process.

Fix

The report references HarfBuzz pull request 5929 as the upstream fix, alongside advisory GHSA-5xrh-8c3h-7c49. The report does not describe the contents of the patch; the defect it addresses is the break that exits only the inner loop, leaving the outer step loop to continue into CUT with a partial extra_glyphs_needed.

Variants to test

  1. Other shapers with accumulation counters: look for uint32 or size_t accumulators that are summed across groups or runs and then used to size a buffer, and check whether an overflow guard exits only an inner loop. A positive result is a guard that fires but is followed by a write pass using the pre-overflow value. size_t is an unsigned integer type used for sizes and counts.
  2. Other browsers and text stacks: check whether the caller caps the length of a shaping run. A positive result is a caller that passes an unbounded run to hb_shape() where the shaping code has an overflow path, as Blink does here.
  3. Other OpenType features that expand one glyph into many (stch is one; substitution and multiple-substitution features are others): craft a font where the expansion count is attacker-controlled and drive it with a long run. A positive result is an allocation sized from a partial count followed by a write of the full count. OpenType is the font format standard that defines these features.
  4. 32-bit builds: repeat the same page on a 32-bit renderer. A positive result is a write that stays inside the process address space, which is the more interesting case for exploitation than the 64-bit crash.

Glossary

  • ASan (AddressSanitizer): a tool built into a special build of a program that watches memory accesses and reports out-of-bounds ones with a detailed log.
  • Advisory: a public notice describing a security problem and its fix.
  • Artefact: a file used in a test, such as a crafted font or a test page.
  • Blink: the part of Chrome that turns HTML and CSS into a page on screen.
  • Buffer: a block of memory reserved to hold data, here the glyphs being shaped.
  • CVE: a public catalogue number given to a known security flaw.
  • content_shell: a bare-bones test browser without the normal Chrome interface.
  • Crafted font: a font file built on purpose to trigger a specific behaviour.
  • CUT pass: the HarfBuzz step that writes the stretched glyphs into the buffer.
  • Fragment cap: a limit on how many characters can be shaped in one call.
  • Glyph: one drawn shape in a font, such as a letter or a stretched form.
  • HarfBuzz: the shaping engine that turns text plus a font into positioned glyphs.
  • Heap: the general pool of memory a program uses for data it creates while running.
  • Integer overflow: when a whole number is added past its maximum and wraps around to a small value.
  • Loopback address: [redacted], meaning this machine itself.
  • MEASURE pass: the HarfBuzz step that counts how many extra glyphs will be needed.
  • Memory corruption: a bug where a program writes to memory it should not, potentially changing other data.
  • OpenType: the font format standard that defines features such as stch.
  • Out-of-bounds write: writing past the end of a reserved block of memory.
  • Port: the numbered door on a machine where a server listens.
  • Process ID (pid): a number the operating system assigns to each running program.
  • Pull request: a proposed change to a code repository, reviewed and merged by maintainers.
  • Renderer: the part of the browser that draws pages, running in a sandbox.
  • Right-to-left run: a stretch of text in a script that reads right to left, such as Arabic.
  • Sandbox: a restricted environment that limits what a compromised program can do to the rest of the machine.
  • Segv (segmentation fault): the operating system's signal that a program touched memory it should not have.
  • Shaping: turning a string of text plus a font into drawn glyphs with positions.
  • size_t: an unsigned integer type used for sizes and counts.
  • stch: a font feature that replaces one glyph with several copies of a repeating glyph, stretching it.
  • uint32: an unsigned 32-bit integer, holding 0 to 4,294,967,295.
  • @font-face: the CSS rule that tells the browser to download and use a font file from a URL.

More by Matej Smycka

View all

1 more disclosed report, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.