Skip to content

Commit

Permalink
Avoided merging runlists with no runs
Browse files Browse the repository at this point in the history
Runlists with no runs are tolerated though not expected. However merging
such runlists is problematic as there is no significant vcn to examine.
So avoid merging them, and just return the other runlist.
  • Loading branch information
jpandre committed Sep 14, 2022
1 parent 18bfc67 commit 76c3a79
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libntfs-3g/runlist.c
Expand Up @@ -994,13 +994,18 @@ static runlist_element *ntfs_mapping_pairs_decompress_i(const ntfs_volume *vol,
rl[rlpos].vcn = vcn;
rl[rlpos].length = (s64)0;
/* If no existing runlist was specified, we are done. */
if (!old_rl) {
if (!old_rl || !old_rl[0].length) {
ntfs_log_debug("Mapping pairs array successfully decompressed:\n");
ntfs_debug_runlist_dump(rl);
if (old_rl)
free(old_rl);
return rl;
}
/* Now combine the new and old runlists checking for overlaps. */
old_rl = ntfs_runlists_merge(old_rl, rl);
if (rl[0].length)
old_rl = ntfs_runlists_merge(old_rl, rl);
else
free(rl);
if (old_rl)
return old_rl;
err = errno;
Expand Down

0 comments on commit 76c3a79

Please sign in to comment.