In ntfs_comp_set(), NTFS-3g will write uninitialized memory if the compressed data partially fills the last cluster. Fix by zeroing the memory.
Error reported from valgrind: Syscall param pwrite64(buf) points to uninitialised byte(s) at 0x3C7520FA63: __pwrite_nocancel (in /usr/lib64/libpthread-2.20.so) by 0x4F216E7: ntfs_device_unix_io_pwrite (unix_io.c:302) by 0x4EF8836: ntfs_pwrite (device.c:278) by 0x4EF6531: write_clusters (compress.c:1038) by 0x4EF67B0: ntfs_comp_set (compress.c:1134) by 0x4EF804B: ntfs_compressed_pwrite (compress.c:1802) by 0x4EE99FC: ntfs_attr_pwrite (attrib.c:2219) Address 0x521e7c0 is 52,384 bytes inside a block of size 65,570 alloc'd at 0x4A06BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4F0E114: ntfs_malloc (misc.c:57) by 0x4EF65E6: ntfs_comp_set (compress.c:1086) by 0x4EF804B: ntfs_compressed_pwrite (compress.c:1802) by 0x4EE99FC: ntfs_attr_pwrite (attrib.c:2219) --- libntfs-3g/compress.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs-3g/compress.c b/libntfs-3g/compress.c index f1070aa..a8d37e8 100644 --- a/libntfs-3g/compress.c +++ b/libntfs-3g/compress.c @@ -1131,6 +1131,7 @@ static s32 ntfs_comp_set(ntfs_attr *na, runlist_element *rl, outbuf[compsz++] = 0; /* write a full cluster, to avoid partial reading */ rounded = ((compsz - 1) | (clsz - 1)) + 1; + memset(&outbuf[compsz], 0, rounded - compsz); written = write_clusters(vol, rl, offs, rounded, outbuf); if (written != rounded) { /* -- 2.1.0 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ ntfs-3g-devel mailing list ntfs-3g-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel