Browse code

zziplib fix

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@164 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2003/12/24 23:29:55
Showing 3 changed files
... ...
@@ -44,6 +44,7 @@ Hrvoje Habjanic <hrvoje.habjanic*zg.hinet.hr>
44 44
 Nicholas M. Kirsch <nick*kirsch.org>
45 45
 Robbert Kouprie <robbert*exx.nl>
46 46
 Thomas Lamy <Thomas.Lamy*in-online.net>
47
+Marty Lee <marty*maui.co.uk>
47 48
 Peter N Lewis <peter*stairways.com.au>
48 49
 David S. Madole <david*madole.net>
49 50
 Denis De Messemacker <ddm*clamav.net>
... ...
@@ -1,3 +1,9 @@
1
+Wed Dec 24 15:27:22 CET 2003 (tk)
2
+---------------------------------
3
+  * libclamav: zziplib - fixed a bus error when compiled with the Sun compiler
4
+			 on the 64 bit SPARC (patch by Marty Lee
5
+			 <marty*maui.co.uk>)
6
+
1 7
 Wed Dec 24 02:28:42 CET 2003 (tk)
2 8
 ---------------------------------
3 9
   * libclamav: fixed my last patch (instead of a value, a pointer was compared)
... ...
@@ -102,10 +102,20 @@ _zzip_inline static void __fixup_rootseek(
102 102
  * anything in zziplib or dump the trailer structure then watch out that
103 103
  * these are still unused, so that this code may still (ab)use those. */
104 104
 #define __fixup_rootseek(_offset_of_trailer, _trailer)          \
105
-                      *(zzip_off_t*)_trailer = _offset_of_trailer;
105
+		_trailer->z_magic[0] = _offset_of_trailer & 0xff; \
106
+		_trailer->z_magic[1] = _offset_of_trailer >> 8 & 0xff ; \
107
+		_trailer->z_magic[2] = _offset_of_trailer >> 16 & 0xff ; \
108
+		_trailer->z_magic[3] = _offset_of_trailer >> 24 & 0xff ; \
109
+		_trailer->z_disk[0] = 0 ; \
110
+		_trailer->z_disk[1] = 0 ; \
111
+		_trailer->z_finaldisk[0] = 0 ; \
112
+		_trailer->z_finaldisk[1] = 0 ;
113
+#define __trailer_to_address(_trailer) \
114
+	(_trailer->z_magic[0] + (_trailer->z_magic[1] << 8) + \
115
+	(_trailer->z_magic[2] << 16) + (_trailer->z_magic[3] << 25))
106 116
 #define __correct_rootseek( _u_rootseek, _u_rootsize, _trailer) \
107
-    if (_u_rootseek > *(zzip_off_t*)_trailer - _u_rootsize)     \
108
-	_u_rootseek = *(zzip_off_t*)_trailer - _u_rootsize;
117
+    if (_u_rootseek > __trailer_to_address(_trailer) - _u_rootsize)     \
118
+	_u_rootseek = __trailer_to_address(_trailer) - _u_rootsize;
109 119
 #else
110 120
 #define __fixup_rootseek(A,B) 
111 121
 #define __correct_rootseek(A,B,C)