Fixed the computation of highest_vcn when applying a runlist fixup

When a file is partially truncated, the highest_vcn has to be recomputed
before the file size is adjusted. As a consequence the unmapped run
inserted at the end of runlist to match the file size should not be taken
into account when determining the higest_vcn.
This commit is contained in:
Jean-Pierre André 2017-05-25 10:52:54 +02:00
parent 1797ab5ecd
commit 5be0b9f62a

View File

@ -806,7 +806,9 @@ static int adjust_high_vcn(ntfs_volume *vol, ATTR_RECORD *attr)
rl = ntfs_mapping_pairs_decompress(vol, attr, (runlist_element*)NULL); rl = ntfs_mapping_pairs_decompress(vol, attr, (runlist_element*)NULL);
if (rl) { if (rl) {
xrl = rl; xrl = rl;
while (xrl->length) if (xrl->length)
xrl++;
while ((xrl->length) && (xrl->lcn != LCN_RL_NOT_MAPPED))
xrl++; xrl++;
high_vcn = xrl->vcn - 1; high_vcn = xrl->vcn - 1;
attr->highest_vcn = cpu_to_sle64(high_vcn); attr->highest_vcn = cpu_to_sle64(high_vcn);