Out-of-bounds Access in libvterm Resize Handling in Vim
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub.
Summary
Vim versions before 9.2.1013 bundle a libvterm that accepts terminal resize requests without limiting the size, while the screen storage is clamped to 1000 rows and 1000 columns. A program running in a Vim terminal window can send a resize sequence that leaves the terminal state larger than its allocated line information. Output then moves the cursor past the end of that allocation, causing out-of-bounds reads and writes in the Vim process (CWE-787, CWE-1284). The source demonstrates memory corruption leading to a crash, and says the program in the terminal cannot observe what is read.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
Out-of-bounds Access in libvterm Resize Handling in Vim < 9.2.1013 ============================================ Date: 26.08.2026 Severity: Medium CVE: *requested, not yet assigned* CWE: Out-of-bounds Write (CWE-787), Improper Validation of Specified Quantity in Input (CWE-1284) ## Summary The bundled libvterm keeps the terminal size in two places: `VTermState`, which holds the cursor position and the bounds used to clamp it, and `VTermScreen`, which owns the storage for the cells and the line information. The `CSI 8 ; rows ; cols t` sequence, with which a program running in a terminal window asks for a new size, was written into `VTermState` unchanged, while the screen clamped it to `VTERM_MAX_ROWS` and `VTERM_MAX_COLS` when allocating the storage. The clamped value was not reported back, so the state kept the requested size. All later bound checks then used a size that is much larger than the allocated line information, and ordinary text output could move the cursor beyond it, reading and writing past the end of the allocation. ## Description Programs in a terminal window can send `CSI 8 ; rows ; cols t` to request a new size. The only limit on the values is the one the argument parser applies to any numeric argument, about 1.07 billion. `on_resize()` in `src/libvterm/src/state.c` stored them directly: state->rows = rows; state->cols = cols; and raised `scrollregion_bottom` accordingly, before calling the resize callback. That callback, `resize()` in `src/libvterm/src/screen.c`, clamps the size to `VTERM_MAX_ROWS` and `VTERM_MAX_COLS`, both 1000, and allocates the `VTermLineInfo` array for the clamped number of rows. It updates the screen's own size but has no way to correct the state, and `on_resize()` does not read the size back. After a request such as `CSI 8 ; 50000 ; 200 t` the state therefore reports 50000 rows while the line information holds 1000 entries. Because the scroll region was widened as well, `linefeed()` no longer scrolls at the bottom of the screen, it only advances the cursor row. Printing more than 1000 lines, or printing enough text to wrap that often, moves the cursor past the end of the array. The issue has been addressed by clamping the requested size to the same limits the screen uses, at the start of `on_resize()`, before the state is updated and before any storage is allocated. ## Impact Heap out-of-bounds read and write in the process running Vim. The values written are small fixed constants rather than attacker-controlled data and the offset follows the amount of output produced, so the demonstrated consequence is memory corruption leading to a crash. There is no channel through which the program in the terminal can observe what is read. Exploitation requires: - Vim compiled with the `terminal` feature and a terminal window open, - output rendered in that window from a program under the attacker's control, for example a connection to a malicious SSH server, a file shown with a pager, or the log of a compromised build tool, - the escape sequence and the following output to arrive together, without Vim redrawing in between, which happens for any program producing a continuous stream of output. No privileges on the host running Vim are needed and the sequence is ordinary output on the program's own standard output stream. The severity is rated Medium because the impact demonstrated is a denial of service rather than control over the process, and because the attacker must already have output displayed in a terminal window. This is the second issue in the same sequence in the bundled libvterm. Patch v9.2.0569 rejected missing, zero and negative dimensions, however the values above the supported maximum remained unchecked. ## Acknowledgements The Vim project would like to thank Yazan Balawneh, Cystack.ps for reporting the issue. ## References The issue has been fixed as of Vim patch [v9.2.1013](https://github.com/vim/vim/releases/tag/v9.2.1013). - [Commit](https://github.com/vim/vim/commit/e4f51e505ae0d64c4797c89314ecff1be88135be) - [Github Security Advisory](https://github.com/vim/vim/security/advisories/GHSA-vfc7-mhvm-gjp8) - [Related patch v9.2.0569](https://github.com/vim/vim/releases/tag/v9.2.0569)
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | Vim (vim) | Vim < v9.2.1013 | v9.2.1013 | Patch available | GHSA-vfc7-mhvm-gjp8 |
- Vim (vim) Vendor— Affected Vim < v9.2.1013 Fixed in v9.2.1013 Patch available GHSA-vfc7-mhvm-gjp8
Remediation
Upgrade Vim to version 9.2.1013 or later, which clamps the requested size before the state is updated and before storage is allocated.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-vfc7-mhvm-gjp8 Vim (vim) Fixed in v9.2.1013 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-vfc7-mhvm-gjp8
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences