rpms/file/devel file-4.16-fix-array-64bit.patch, NONE, 1.1 file.spec, 1.42, 1.43

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Jan 13 08:42:06 UTC 2006


Author: rvokal

Update of /cvs/dist/rpms/file/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv13137

Modified Files:
	file.spec 
Added Files:
	file-4.16-fix-array-64bit.patch 
Log Message:
- fix for 64bit arrays

file-4.16-fix-array-64bit.patch:
 readelf.c |   26 +++++++++++---------------
 readelf.h |    1 +
 2 files changed, 12 insertions(+), 15 deletions(-)

--- NEW FILE file-4.16-fix-array-64bit.patch ---
--- src/readelf.h
+++ src/readelf.h
@@ -50,6 +50,7 @@
 typedef	uint32_t 	Elf64_Off[2];
 typedef uint32_t 	Elf64_Xword[2];
 #else
+#undef USE_ARRAY_FOR_64BIT_TYPES
 typedef	uint64_t 	Elf64_Addr;
 typedef	uint64_t 	Elf64_Off;
 typedef uint64_t 	Elf64_Xword;
--- src/readelf.c
+++ src/readelf.c
@@ -121,6 +121,14 @@
 		return value;
 }
 
+#ifdef USE_ARRAY_FOR_64BIT_TYPES
+# define elf_getu64(swap, array) \
+	((swap ? ((uint64_t)getu32(swap, array[0])) << 32 : getu32(swap, array[0])) + \
+	 (swap ? getu32(swap, array[1]) : ((uint64_t)getu32(swap, array[1]) << 32)))
+#else
+# define elf_getu64(swap, value) getu64(swap, value)
+#endif
+
 #define xsh_addr	(class == ELFCLASS32		\
 			 ? (void *) &sh32		\
 			 : (void *) &sh64)
@@ -913,11 +921,7 @@
 		if (getu16(swap, elfhdr.e_type) == ET_CORE) {
 #ifdef ELFCORE
 			if (dophn_core(ms, class, swap, fd,
-#ifdef USE_ARRAY_FOR_64BIT_TYPES
-			    (off_t)getu32(swap, elfhdr.e_phoff[1]),
-#else
-			    (off_t)getu64(swap, elfhdr.e_phoff),
-#endif
+			    (off_t)elf_getu64(swap, elfhdr.e_phoff),
 			    getu16(swap, elfhdr.e_phnum), 
 			    (size_t)getu16(swap, elfhdr.e_phentsize)) == -1)
 				return -1;
@@ -927,22 +931,14 @@
 		} else {
 			if (getu16(swap, elfhdr.e_type) == ET_EXEC) {
 				if (dophn_exec(ms, class, swap, fd,
-#ifdef USE_ARRAY_FOR_64BIT_TYPES
-				    (off_t)getu32(swap, elfhdr.e_phoff[1]),
-#else
-				    (off_t)getu64(swap, elfhdr.e_phoff),
-#endif
+				    (off_t)elf_getu64(swap, elfhdr.e_phoff),
 				    getu16(swap, elfhdr.e_phnum), 
 				    (size_t)getu16(swap, elfhdr.e_phentsize))
 				    == -1)
 					return -1;
 			}
 			if (doshn(ms, class, swap, fd,
-#ifdef USE_ARRAY_FOR_64BIT_TYPES
-			    (off_t)getu32(swap, elfhdr.e_shoff[1]),
-#else
-			    (off_t)getu64(swap, elfhdr.e_shoff),
-#endif
+			    (off_t)elf_getu64(swap, elfhdr.e_shoff),
 			    getu16(swap, elfhdr.e_shnum),
 			    (size_t)getu16(swap, elfhdr.e_shentsize)) == -1)
 				return -1;


Index: file.spec
===================================================================
RCS file: /cvs/dist/rpms/file/devel/file.spec,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- file.spec	9 Dec 2005 22:40:24 -0000	1.42
+++ file.spec	13 Jan 2006 08:42:03 -0000	1.43
@@ -3,7 +3,7 @@
 Summary: A utility for determining file types.
 Name: file
 Version: 4.16
-Release: 4.1
+Release: 5
 License: distributable
 Group: Applications/File
 Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
@@ -16,6 +16,7 @@
 Patch8: file-4.15-berkeley.patch
 Patch9: file-4.16-readelf.patch
 Patch10: file-4.16-dont_use_isprint.patch
+Patch11: file-4.16-fix-array-64bit.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildRequires: zlib-devel
 
@@ -38,6 +39,7 @@
 %patch8 -p1 -b .berkeley
 %patch9 -p1 -b .corefile
 %patch10 -p1 -b .isprint
+%patch11 -p0 -b .64bit
 
 iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
 mv doc/libmagic.man_ doc/libmagic.man
@@ -83,6 +85,9 @@
 %{_libdir}/libmagic.*
 
 %changelog
+* Fri Jan 13 2006 Radek Vokal <rvokal at redhat.com> 4.16-5
+- fix for 64bit arrays
+
 * Fri Dec 09 2005 Jesse Keating <jkeating at redhat.com>
 - rebuilt
 




More information about the fedora-cvs-commits mailing list