- lib-fs-resize: Prevent crash resizing FAT with very deep directories
- Add libparted/fs/.libs/ to LD_LIBRARY_PATH during make check
This commit is contained in:
parent
e0ee88ed50
commit
4d35fa8c43
@ -0,0 +1,33 @@
|
||||
From 9a95ca5da96846f3edea48ab18c6365001805e70 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||
Date: Sun, 28 Feb 2016 15:36:10 +0000
|
||||
Subject: [PATCH 29/30] lib-fs-resize: Prevent crash resizing FAT with very
|
||||
deep directories
|
||||
|
||||
Resizing a FAT file system crashes in libparted/fs/r/fat/count.c
|
||||
flag_traverse_dir() if the length of any path name in the file system
|
||||
overflows the 512 byte file_name local buffer. Increase buffer to 4096,
|
||||
PATH_MAX on Linux.
|
||||
|
||||
Reported in
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=762448
|
||||
---
|
||||
libparted/fs/r/fat/count.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c
|
||||
index 7949e47..a5837c0 100644
|
||||
--- a/libparted/fs/r/fat/count.c
|
||||
+++ b/libparted/fs/r/fat/count.c
|
||||
@@ -219,7 +219,7 @@ flag_traverse_dir (FatTraverseInfo* trav_info) {
|
||||
PedFileSystem* fs = trav_info->fs;
|
||||
FatDirEntry* this_entry;
|
||||
FatTraverseInfo* subdir_trav_info;
|
||||
- char file_name [512];
|
||||
+ char file_name [4096];
|
||||
char* file_name_start;
|
||||
FatCluster first_cluster;
|
||||
PedSector size;
|
||||
--
|
||||
2.5.0
|
||||
|
49
0030-tests-t3000-resize-fs.sh-Add-very-deep-directory.patch
Normal file
49
0030-tests-t3000-resize-fs.sh-Add-very-deep-directory.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From 599ce25c802fc1154ed619fde4249bb381430407 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||
Date: Sun, 28 Feb 2016 15:36:11 +0000
|
||||
Subject: [PATCH 30/30] tests: t3000-resize-fs.sh: Add very deep directory
|
||||
|
||||
Create 500 deep directory tree, with longest name of 4000 characters, to
|
||||
the file system being resized to test the fix to prevent crash when
|
||||
resizing a FAT file system with such a long path.
|
||||
---
|
||||
tests/t3000-resize-fs.sh | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
|
||||
index a79a307..608871c 100755
|
||||
--- a/tests/t3000-resize-fs.sh
|
||||
+++ b/tests/t3000-resize-fs.sh
|
||||
@@ -46,6 +46,13 @@ device_sectors_required=$(echo $default_end | sed 's/s$//')
|
||||
# Ensure that $dev is large enough for this test
|
||||
test $device_sectors_required -le $dev_n_sectors || fail=1
|
||||
|
||||
+# create mount point dir
|
||||
+mount_point="`pwd`/mnt"
|
||||
+mkdir "$mount_point" || fail=1
|
||||
+
|
||||
+# be sure to unmount upon interrupt, failure, etc.
|
||||
+cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
|
||||
+
|
||||
for fs_type in hfs+ fat32 fat16; do
|
||||
echo "fs_type=$fs_type"
|
||||
|
||||
@@ -69,6 +76,15 @@ for fs_type in hfs+ fat32 fat16; do
|
||||
# create the file system
|
||||
$mkfs_cmd ${dev}1 || fail=1
|
||||
|
||||
+ # create 500 deep directory tree with longest name 4000 characters
|
||||
+ # to catch core dump in libparted/fs/r/fat/count.c flag_traverse_dir()
|
||||
+ # overflowing 512 byte file_name local buffer.
|
||||
+ mount "${dev}1" "$mount_point" || fail=1
|
||||
+ cat /dev/null > exp
|
||||
+ ( cd "$mount_point"; for d in `seq 500`; do mkdir TESTDIR; cd TESTDIR; done ) > out
|
||||
+ compare exp out || fail=1 # Ensure no errors creating directory tree
|
||||
+ umount "${dev}1" || fail=1
|
||||
+
|
||||
# NOTE: shrinking is the only type of resizing that works.
|
||||
# resize that file system to be one cylinder (8MiB) smaller
|
||||
fs-resize ${dev}1 0 $new_end > out 2>&1 || fail=1
|
||||
--
|
||||
2.5.0
|
||||
|
10
parted.spec
10
parted.spec
@ -4,7 +4,7 @@
|
||||
Summary: The GNU disk partition manipulation program
|
||||
Name: parted
|
||||
Version: 3.2
|
||||
Release: 16%{?dist}
|
||||
Release: 17%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/System
|
||||
URL: http://www.gnu.org/software/parted
|
||||
@ -42,6 +42,8 @@ Patch0025: 0025-Add-libparted-fs-resize.pc.patch
|
||||
Patch0026: 0026-tests-Add-udevadm-settle-to-wait_for_-loop-1260664.patch
|
||||
Patch0027: 0027-tests-Add-wait-to-t9042-1257415.patch
|
||||
Patch0028: 0028-tests-Fix-t1700-failing-on-a-host-with-a-4k-xfs-file.patch
|
||||
Patch0029: 0029-lib-fs-resize-Prevent-crash-resizing-FAT-with-very-d.patch
|
||||
Patch0030: 0030-tests-t3000-resize-fs.sh-Add-very-deep-directory.patch
|
||||
|
||||
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
@ -131,7 +133,7 @@ V=1 %{__make} %{?_smp_mflags}
|
||||
|
||||
|
||||
%check
|
||||
export LD_LIBRARY_PATH=$(pwd)/libparted/.libs
|
||||
export LD_LIBRARY_PATH=$(pwd)/libparted/.libs:$(pwd)/libparted/fs/.libs
|
||||
make check
|
||||
|
||||
|
||||
@ -179,6 +181,10 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Mar 07 2016 Brian C. Lane <bcl@redhat.com> 3.2-17
|
||||
- lib-fs-resize: Prevent crash resizing FAT with very deep directories
|
||||
- Add libparted/fs/.libs/ to LD_LIBRARY_PATH during make check
|
||||
|
||||
* Mon Feb 29 2016 Brian C. Lane <bcl@redhat.com> 3.2-16
|
||||
- Cleanup library path usage in specfile
|
||||
pkgconfig wasn't finding libparted.pc because it was under /usr/lib64/
|
||||
|
Loading…
Reference in New Issue
Block a user