From 25d0f163eea6289c2efed6cd7b7525bd47a2bd3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Sat, 12 Apr 2014 09:32:59 +0200 Subject: [PATCH] Mapped the runlist when filling an initial hole A bug was introduced by commit d2c7d40a2b494f9bf355c8bbe78c24fa16925f86 : when the beginning of a file was a hole and the runlist span over several MFT extents, the runlist was not mapped on filling the initial hole. This lead to a crash when using torrent to download big files. --- libntfs-3g/attrib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index 9b18f92b..4b2be1bb 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -1272,9 +1272,10 @@ static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs, goto err_out; } else { /* make sure the run ahead of hole is mapped */ - if (((*rl)->lcn == LCN_HOLE) && cur_vcn) { - if (ntfs_attr_map_partial_runlist(na, cur_vcn - 1)) - goto err_out; + if ((*rl)->lcn == LCN_HOLE) { + if (ntfs_attr_map_partial_runlist(na, + (cur_vcn ? cur_vcn - 1 : cur_vcn))) + goto err_out; } } #else