38 lines
1.3 KiB
Diff
38 lines
1.3 KiB
Diff
From 76c3a799a97fbcedeeeca57f598be508ae2a1656 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= <jean-pierre.andre@wanadoo.fr>
|
|
Date: Wed, 14 Sep 2022 08:31:31 +0200
|
|
Subject: [PATCH] Avoided merging runlists with no runs
|
|
|
|
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.
|
|
---
|
|
libntfs-3g/runlist.c | 9 +++++++--
|
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/libntfs-3g/runlist.c b/libntfs-3g/runlist.c
|
|
index 720bdce6..cb01e5a7 100644
|
|
--- a/libntfs-3g/runlist.c
|
|
+++ b/libntfs-3g/runlist.c
|
|
@@ -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;
|