Hello all,

I received the patch below (touched up so it applies to a recent version
of clamav).  Could you please consider it for inclusion?  It appears to
do the right thing for this, namely, making i386 assumptions only happen
on i386.

Thanks,
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | new, adj.:  Different color from        |
|  [EMAIL PROTECTED]             | previous model.                         |
|  http://www.lobefin.net/~steve |                                         |
 --------------------------------------------------------------------------
--- libclamav/upx.c.old 2005-06-23 16:03:12.000000000 -0400
+++ libclamav/upx.c     2005-08-04 08:33:17.000000000 -0400
@@ -193,7 +193,7 @@
 static int doubleebx(char *src, int32_t *myebx, int *scur, int ssize)
 {
   int32_t oldebx = *myebx;
-#if WORDS_BIGENDIAN == 1
+#ifndef __i386__
   char *pt;
   int32_t shift, i = 0;
 #endif
@@ -202,7 +202,7 @@
   if ( !(oldebx & 0x7fffffff)) {
     if (*scur<0 || ssize-*scur<4)
       return -1;
-#if WORDS_BIGENDIAN == 0
+#ifndef __i386__
     oldebx = *(int*)(src+*scur);
 #else
     oldebx = 0;
--- libclamav/others.c.old      2005-07-24 19:30:32.000000000 -0400
+++ libclamav/others.c  2005-08-04 08:32:16.000000000 -0400
@@ -573,8 +573,8 @@
 {
        int32_t ret;
 
-#if WORDS_BIGENDIAN == 0
-    ret = *(int32_t *) buff;
+#if WORDS_BIGENDIAN == 0 && defined(__GNUC__)
+    ret = ((struct { int32_t x; } __attribute__((packed)) *) buff)->x;
 #else
     ret = buff[0] & 0xff;
     ret |= (buff[1] & 0xff) << 8;

Attachment: signature.asc
Description: Digital signature

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

Reply via email to