]> git.pld-linux.org Git - packages/file.git/commitdiff
fix mach-o file crash auto/th/file-5.13-2
authorElan Ruusamäe <glen@delfi.ee>
Mon, 18 Mar 2013 09:13:40 +0000 (11:13 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Mon, 18 Mar 2013 09:13:40 +0000 (11:13 +0200)
$ file embedded/rgloader/rgloader.darwin.bundle
embedded/rgloader/rgloader.darwin.bundle: Mach-O universal binary with 3 architectures: [ I386: Mach-O i386 bundle ] [ X86_64: Mach-O 64-bit x86_64 bundle ] [ : Mach-O ppc bundle ] [ ]
$ rpm -q file
file-5.13-1.1.x86_64

file.spec
macho-crash.patch [new file with mode: 0644]

index a682e980eb1a05473ee9380acb87ed6b03de4918..868b65abf08f7bfcfc0674ba6032fb2c78f5db1f 100644 (file)
--- a/file.spec
+++ b/file.spec
@@ -1,17 +1,3 @@
-#!!!!!!!!!!!!!!!!!!!
-TODO:
-
-file /home/users/glen/tmp/vagrant-1.1.0-root-glen/usr/lib64/vagrant/embedded/rgloader/rgloader.darwin.bundle
-Segmentation fault
-glen@carme-pld packages/vagrant $ q file
-file-5.13-1.x86_64
-
-glen@carme-pld packages/vagrant $ file /home/users/glen/tmp/vagrant-1.1.0-root-glen/usr/lib64/vagrant/embedded/rgloader/rgloader.darwin.bundle
-/home/users/glen/tmp/vagrant-1.1.0-root-glen/usr/lib64/vagrant/embedded/rgloader/rgloader.darwin.bundle: ERROR: Mach-O fat file with 3 architectures: [ I386
-glen@carme-pld packages/vagrant $ q file
-file-5.12-1.x86_64
-#!!!!!!!!!!!!!!!!!!!!
-
 #
 # Conditional build:
 %bcond_without python          # don't build python-magic module
 #
 # Conditional build:
 %bcond_without python          # don't build python-magic module
@@ -43,7 +29,7 @@ Summary(zh_CN.UTF-8): 判定文件类型的工具。
 Summary(zh_TW.UTF-8):  用於決定檔案類型的一個工具程式。
 Name:          file
 Version:       5.13
 Summary(zh_TW.UTF-8):  用於決定檔案類型的一個工具程式。
 Name:          file
 Version:       5.13
-Release:       1.1
+Release:       2
 License:       distributable
 Group:         Applications/File
 Source0:       ftp://ftp.astron.com/pub/file/%{name}-%{version}.tar.gz
 License:       distributable
 Group:         Applications/File
 Source0:       ftp://ftp.astron.com/pub/file/%{name}-%{version}.tar.gz
@@ -59,6 +45,7 @@ Patch2:               searchpath.patch
 Patch3:                automake.patch
 Patch4:                sticky-bit.patch
 Patch5:                cdf-pread.patch
 Patch3:                automake.patch
 Patch4:                sticky-bit.patch
 Patch5:                cdf-pread.patch
+Patch6:                macho-crash.patch
 URL:           http://www.darwinsys.com/file/
 BuildRequires: autoconf >= 2.50
 BuildRequires: automake
 URL:           http://www.darwinsys.com/file/
 BuildRequires: autoconf >= 2.50
 BuildRequires: automake
@@ -268,6 +255,7 @@ Wiązania Pythona dla libmagic.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %if "%{cc_version}" < "3.4"
 %{__sed} -i -e 's,-Wextra,,' configure.ac
 
 %if "%{cc_version}" < "3.4"
 %{__sed} -i -e 's,-Wextra,,' configure.ac
diff --git a/macho-crash.patch b/macho-crash.patch
new file mode 100644 (file)
index 0000000..69f3957
--- /dev/null
@@ -0,0 +1,33 @@
+See file mailinglist thread:
+http://mx.gw.com/pipermail/file/2013/001138.html
+
+From cf289f23851ba3eb017576be1ba65c0a0f0e16a9 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 26 Feb 2013 18:24:43 +0000
+Subject: [PATCH] - avoid 0 offset causing an infinite loop. - XXX: should
+ limit indirect nesting.
+
+---
+ src/softmagic.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/src/softmagic.c b/src/softmagic.c
+index c42ca19..22d1a27 100644
+--- a/src/softmagic.c
++++ b/src/softmagic.c
+@@ -1617,6 +1617,12 @@ private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
+               if (m->flag & INDIROFFADD) {
+                       offset += ms->c.li[cont_level-1].off;
++                      if (offset == 0) {
++                              if ((ms->flags & MAGIC_DEBUG) != 0)
++                                      fprintf(stderr,
++                                          "indirect *zero* offset\n");
++                              return 0;
++                      }
+                       if ((ms->flags & MAGIC_DEBUG) != 0)
+                               fprintf(stderr, "indirect +offs=%u\n", offset);
+               }
+-- 
+1.8.1.5
+
This page took 0.602929 seconds and 4 git commands to generate.