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

Hongling Zeng <[email protected]>
Newsgroups dev.linux.lists.ntfs,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
在 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.