[ntfs-3g] fix bug preventing ability to read compressed files from windows 8 partitions (bz967301)

Tom Callaway spot at fedoraproject.org
Tue May 28 18:48:21 UTC 2013


commit 8a4f93d91776d77e09ee130243f2ba5d9182546a
Author: Tom Callaway <spot at fedoraproject.org>
Date:   Tue May 28 14:48:03 2013 -0400

    fix bug preventing ability to read compressed files from windows 8 partitions (bz967301)

 compress-lastblock-v2.patch |   39 +++++++++++++++++++++++++++++++++++++++
 ntfs-3g.spec                |    8 +++++++-
 2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/compress-lastblock-v2.patch b/compress-lastblock-v2.patch
new file mode 100644
index 0000000..e29f6e9
--- /dev/null
+++ b/compress-lastblock-v2.patch
@@ -0,0 +1,39 @@
+--- libntfs-3g/compress.c.ref	2013-05-07 10:50:28.000000000 +0200
++++ libntfs-3g/compress.c	2013-05-13 16:37:17.000000000 +0200
+@@ -5,7 +5,7 @@
+  * Copyright (c) 2004-2005 Anton Altaparmakov
+  * Copyright (c) 2004-2006 Szabolcs Szakacsits
+  * Copyright (c)      2005 Yura Pakhuchiy
+- * Copyright (c) 2009-2011 Jean-Pierre Andre
++ * Copyright (c) 2009-2013 Jean-Pierre Andre
+  *
+  * This program/include file is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License as published
+@@ -753,6 +753,7 @@
+ 		ofs = 0;
+ 	} else {
+ 		s64 tdata_size, tinitialized_size;
++		int decompsz;
+ 
+ 		/*
+ 		 * Compressed cb, decompress it into the temporary buffer, then
+@@ -810,7 +811,10 @@
+ 		if (cb_pos + 2 <= cb_end)
+ 			*(u16*)cb_pos = 0;
+ 		ntfs_log_debug("Successfully read the compression block.\n");
+-		if (ntfs_decompress(dest, cb_size, cb, cb_size) < 0) {
++		/* Do not decompress beyond the requested block */
++		to_read = min(count, cb_size - ofs);
++		decompsz = ((ofs + to_read - 1) | (NTFS_SB_SIZE - 1)) + 1;
++		if (ntfs_decompress(dest, decompsz, cb, cb_size) < 0) {
+ 			err = errno;
+ 			free(cb);
+ 			free(dest);
+@@ -819,7 +823,6 @@
+ 			errno = err;
+ 			return -1;
+ 		}
+-		to_read = min(count, cb_size - ofs);
+ 		memcpy(b, dest + ofs, to_read);
+ 		total += to_read;
+ 		count -= to_read;
diff --git a/ntfs-3g.spec b/ntfs-3g.spec
index 14a78c6..57a04a7 100644
--- a/ntfs-3g.spec
+++ b/ntfs-3g.spec
@@ -8,7 +8,7 @@
 Name:		ntfs-3g
 Summary:	Linux NTFS userspace driver
 Version:	2013.1.13
-Release:	4%{?dist}
+Release:	5%{?dist}
 License:	GPLv2+
 Group:		System Environment/Base
 Source0:	http://tuxera.com/opensource/%{name}_ntfsprogs-%{version}%{?subver}.tgz
@@ -29,6 +29,8 @@ Patch0:		ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch
 Patch1:		ntfsck.c.4Ksectors.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=958681
 Patch2:		ntfs-3g-truncated-check.patch
+# http://tuxera.com/forum/viewtopic.php?p=37574#p37574
+Patch3:		compress-lastblock-v2.patch
 
 %description
 NTFS-3G is a stable, open source, GPL licensed, POSIX, read/write NTFS 
@@ -76,6 +78,7 @@ included utilities see man 8 ntfsprogs after installation).
 %patch0 -p1 -b .unsupported
 %patch1 -p0 -b .4k
 %patch2 -p0 -b .truncated
+%patch3 -p0 -b .compressfix
 
 %build
 CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
@@ -174,6 +177,9 @@ rm -rf %{buildroot}%{_defaultdocdir}/%{name}/README
 %exclude %{_mandir}/man8/ntfs-3g*
 
 %changelog
+* Tue May 28 2013 Tom Callaway <spot at fedoraproject.org> - 2:2013.1.13-5
+- fix bug preventing reads on compressed files on windows 8 partitions (bz967301)
+
 * Mon May  6 2013 Tom Callaway <spot at fedoraproject.org> - 2:2013.1.13-4
 - apply fixes from upstream for issue with 4K sector drives (bz951603) 
   and truncated check for Interix types on a 32-bit CPU (bz958681)


More information about the scm-commits mailing list