CVE-2026-139258: ntfs: widen the sub-block offsets in ntfs_decompress()
In the Linux kernel, the following vulnerability has been resolved:
ntfs: widen the sub-block offsets in ntfsdecompress()
ntfsdecompress() tracks where the current sub-block starts and ends inside the destination page with two u16s:
u16 dosbstart; u16 dosbend; ... dosbstart = destofs; dosbend = dosbstart + NTFSSBSIZE;
destofs is an int page offset masked with ~PAGEMASK, and NTFSSBSIZE is 0x1000, so dosbend needs PAGESIZE + 0xfff of range. That exceeds u16 once PAGESIZE reaches 0x10000: the last sub-block of a page starts at 0xf000 and dosbend wraps from 0x10000 to 0.
The zero-fill that pads a short sub-block then computes a negative length:
if (dpaddr < dpsbend) { int nrbytes = dosbend - destofs;
memset(dpaddr, 0, nrbytes);
A sub-block made only of symbol tokens reaches this without consulting dosbend on the way, because that path just does
dpaddr++ = cb++; ++destofs;
and is bounded by dpaddr against dpsbend. With dosbstart at 0xf000 and eight literal bytes emitted, nrbytes is -61448 and the memset() runs for 18446744073709490168 bytes.
Getting there is cheap: fifteen sub-blocks of eleven bytes each advance destofs to 0xf000, since the same zero-fill pads each of them out to 0x1000 while dosbend is still exact, and the sixteenth one triggers the wrap. A compression block is 0x10000 bytes with 4 KiB clusters and the fixed compression unit of 4, so all sixteen fit with room to spare.
Phrase tokens are bounded against dosbend and so return -EOVERFLOW instead, and the
if (destindex == destmaxindex && dosbend > destmaxofs)
check at the top of the sub-block stops firing for the same reason.
Use int for both, matching destofs and destmaxofs. The narrow type came in with the original import and survived the removal and revert of the driver.
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to the offset wraparound?
The overflow condition requires a kernel page size of at least 0x10000 (64 KiB). On such systems, the final 0x1000-byte NTFS sub-block in a page can cause the 16-bit end offset to wrap to zero.
What input is needed to trigger the oversized write?
An attacker needs compressed NTFS data arranged to advance the destination offset to 0xf000 and then emit a short sub-block through the symbol-token path. The described example uses fifteen 11-byte sub-blocks followed by eight literal bytes, causing a negative zero-fill length that becomes a very large memset size.