Re: [PATCH v3] ntfs: validate non-resident attribute offsets

From: Hongling Zeng

Date: Thu Aug 06 2026 - 21:59:30 EST



在 2026年08月06日 21:17, Namjae Jeon 写道:
+ /* Ensure there's room for the compressed_size field if needed. */
+ if (!(a->flags & ATTR_IS_SPARSE) &&
+ !(a->flags & ATTR_IS_COMPRESSED) &&
+ attr_len - mp_offset < sizeof(a->data.non_resident.compressed_size))
+ return false;
Sorry for the confusion. I rechecked the code and realized that
ATTR_COMPRESSION_MASK is correct here. It covers the entire
compression field, while ATTR_IS_COMPRESSED checks only the 0x0001
bit. Since this validation checks whether the attribute layout
includes compressed_size, it should use the mask, consistent with the
existing min_len check. So I have applied the previously attached
patch.

Thanks!
You're absolutely correct, Thanks for the guidance and applied the patch . I now understand that ATTR_COMPRESSION_MASK
(0x00ff) is the correct choice—it covers all compression cases, not just the 0x0001 flag.