pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/archivers/arj arj: fix pointer truncation issues, alig...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a911a7b43b03
branches:  trunk
changeset: 371283:a911a7b43b03
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sat Jan 08 14:43:09 2022 +0000

description:
arj: fix pointer truncation issues, alignment issues and other LP64 issues

Mostly via Debian. Re-enable package on LP64.

diffstat:

 archivers/arj/Makefile                  |    6 +-
 archivers/arj/distinfo                  |    9 ++-
 archivers/arj/patches/patch-arj__arcv.c |   70 ++++++++++++++++++++
 archivers/arj/patches/patch-arj__proc.c |  110 ++++++++++++++++++++++++++++++++
 archivers/arj/patches/patch-arj__proc.h |   71 ++++++++++++++++++++
 archivers/arj/patches/patch-arjtypes.c  |   73 +++++++++++++++++++++
 archivers/arj/patches/patch-decode.c    |   35 +++++++++-
 archivers/arj/patches/patch-postproc.c  |   31 +++++++++
 8 files changed, 397 insertions(+), 8 deletions(-)

diffs (truncated from 477 to 300 lines):

diff -r e471a174a6f4 -r a911a7b43b03 archivers/arj/Makefile
--- a/archivers/arj/Makefile    Sat Jan 08 12:11:51 2022 +0000
+++ b/archivers/arj/Makefile    Sat Jan 08 14:43:09 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.35 2020/01/26 05:26:08 rillig Exp $
+# $NetBSD: Makefile,v 1.36 2022/01/08 14:43:09 tnn Exp $
 
 DISTNAME=      arj-3.10.22
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    archivers
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=arj/}
 
@@ -31,8 +31,6 @@
 
 INSTALLATION_DIRS+=    ${ARJ_DOCSDIR}
 
-BROKEN_ON_PLATFORM=    ${LP64PLATFORMS}
-
 post-install:
        ${INSTALL_DATA} ${WRKSRC}/doc/COPYING ${WRKSRC}/doc/debug.txt   \
                                        ${DESTDIR}${ARJ_DOCSDIR}
diff -r e471a174a6f4 -r a911a7b43b03 archivers/arj/distinfo
--- a/archivers/arj/distinfo    Sat Jan 08 12:11:51 2022 +0000
+++ b/archivers/arj/distinfo    Sat Jan 08 14:43:09 2022 +0000
@@ -1,13 +1,17 @@
-$NetBSD: distinfo,v 1.25 2021/10/26 09:57:04 nia Exp $
+$NetBSD: distinfo,v 1.26 2022/01/08 14:43:09 tnn Exp $
 
 BLAKE2s (arj-3.10.22.tar.gz) = 3693d1767527e7f1cdc813d838728389c4ec6fb7910ed272eb1aa1d9645f77eb
 SHA512 (arj-3.10.22.tar.gz) = 4730dfdbab4f8095396c337578ed69bdaae52955ad468db50b52af8ad2846ecd6cfc05eb3ac0d03838c1c32ea60126f14a22b93e8181c06b9546456f3937ff76
 Size (arj-3.10.22.tar.gz) = 431467 bytes
+SHA1 (patch-arj__arcv.c) = 4d6c0df2a7845f71896dcd989ac3fc935b972ec7
+SHA1 (patch-arj__proc.c) = 267a9837b0655b2534f2f25a76b1055bb802d9d6
+SHA1 (patch-arj__proc.h) = 517d695638ac7c0ae319f5249dc955b3c3c77590
 SHA1 (patch-arj__user.c) = 011e5deaa24c696b212beadad7d386ccb3c7112d
 SHA1 (patch-arjdata.c) = 4e4c142b97feee0673b14ea6f454f3d9de45f584
 SHA1 (patch-arjdisp.c) = d843d4dd1006ea30e8bb3a2acddbc2f0ac221abd
 SHA1 (patch-arjsfx.c) = c9e2314d0933cdc12f8e01ca16bc9222ac4e10b9
-SHA1 (patch-decode.c) = 15c31c3bf1303370691b701a98bad88ae1b0967b
+SHA1 (patch-arjtypes.c) = 3f4f83472fa70c55908fe6d89fa0a3d009e68e8a
+SHA1 (patch-decode.c) = d6a2a4f60cb326aabb6bd25973d0aa7901c8595f
 SHA1 (patch-environ.c) = e306005a88825b2bfd5b3bb35b18710d26a4c885
 SHA1 (patch-exe__sear.c) = 6d8db5a2cdb8f2452b96cf4d09687ae9d45d3e17
 SHA1 (patch-fardata.c) = b76ac5a168b9a8e288a610dce093280d31520af6
@@ -16,6 +20,7 @@
 SHA1 (patch-gnu_makefile.in) = db8a0afa61f49242e9fd601d5fc3167cf75f748b
 SHA1 (patch-integr.c) = fade32219b21ac3382028bf23ee4171d8d095b5f
 SHA1 (patch-msgbind.c) = fa395b0b8b74f4b430a870254a1aa1554f2bb8e7
+SHA1 (patch-postproc.c) = c107de57a691a4937007eca5d0e4afdbc9fa0ba3
 SHA1 (patch-register.c) = 8d81e663b499a45f7faa52b16a6cee47394cd09c
 SHA1 (patch-resource_resource.txt) = ea7044dc8a6e4fed213f00f8db9f6c1ab5df6f72
 SHA1 (patch-uxspec.c) = 24a22fa2822704e620b38df12b76ef88fe908863
diff -r e471a174a6f4 -r a911a7b43b03 archivers/arj/patches/patch-arj__arcv.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/archivers/arj/patches/patch-arj__arcv.c   Sat Jan 08 14:43:09 2022 +0000
@@ -0,0 +1,70 @@
+$NetBSD: patch-arj__arcv.c,v 1.1 2022/01/08 14:43:09 tnn Exp $
+
+debian/003_64_bit_clean.patch
+Description: Make code 64-bit clean.
+Author: Guillem Jover <guillem%debian.org@localhost>
+Origin: vendor
+Bug-Debian: https://bugs.debian.org/339815
+Forwarded: no
+Last-Update: 2005-11-24
+
+--- arj_arcv.c.orig    2005-06-21 19:53:12.000000000 +0000
++++ arj_arcv.c
+@@ -59,27 +59,27 @@ static char idxid_fault[]="?";
+ #define setup_hput(ptr) (tmp_hptr=(ptr))
+ 
+ #define hget_byte() (*(tmp_hptr++)&0xFF)
+-#define hput_byte(c) (*(tmp_hptr++)=(char) (c))
++#define hput_byte(c) (*(tmp_hptr++)=(uint8_t) (c))
+ 
+ /* Reads two bytes from the header, incrementing the pointer */
+ 
+-static unsigned int hget_word()
++static uint16_t hget_word()
+ {
+- unsigned int result;
++ uint16_t result;
+ 
+  result=mget_word(tmp_hptr);
+- tmp_hptr+=sizeof(short);
++ tmp_hptr+=sizeof(uint16_t);
+  return result;
+ }
+ 
+ /* Reads four bytes from the header, incrementing the pointer */
+ 
+-static unsigned long hget_longword()
++static uint32_t hget_longword()
+ {
+- unsigned long result;
++ uint32_t result;
+ 
+  result=mget_dword(tmp_hptr);
+- tmp_hptr+=sizeof(unsigned long);
++ tmp_hptr+=sizeof(uint32_t);
+  return result;
+ }
+ 
+@@ -87,18 +87,18 @@ static unsigned long hget_longword()
+ 
+ /* Writes two bytes to the header, incrementing the pointer */
+ 
+-static void hput_word(unsigned int w)
++static void hput_word(uint16_t w)
+ {
+  mput_word(w,tmp_hptr); 
+- tmp_hptr+=sizeof(unsigned short);
++ tmp_hptr+=sizeof(uint16_t);
+ }
+ 
+ /* Writes four bytes to the header, incrementing the pointer */
+ 
+-static void hput_longword(unsigned long l)
++static void hput_longword(uint32_t l)
+ {
+  mput_dword(l,tmp_hptr);
+- tmp_hptr+=sizeof(unsigned long);
++ tmp_hptr+=sizeof(uint32_t);
+ }
+ 
+ /* Calculates and stores the basic header size */
diff -r e471a174a6f4 -r a911a7b43b03 archivers/arj/patches/patch-arj__proc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/archivers/arj/patches/patch-arj__proc.c   Sat Jan 08 14:43:09 2022 +0000
@@ -0,0 +1,110 @@
+$NetBSD: patch-arj__proc.c,v 1.1 2022/01/08 14:43:09 tnn Exp $
+
+debian/001_arches_align.patch
+Description: Correct build failure on ia64 due to unaligned memory access.
+Author: Guillem Jover <guillem%debian.org@localhost>
+Origin: vendor
+Forwarded: no
+Last-Update: 2008-06-16
+
+
+debian/003_64_bit_clean.patch
+Description: Make code 64-bit clean.
+Author: Guillem Jover <guillem%debian.org@localhost>
+Origin: vendor
+Bug-Debian: https://bugs.debian.org/339815
+Forwarded: no
+Last-Update: 2005-11-24
+
+debian/self_integrity_64bit.patch
+Description: Fix arj self-integrity check on 64-bit systems
+Author: B Watson <yalhcru%gmail.com@localhost>
+Origin: other, http://slackbuilds.org/cgit/slackbuilds/tree/system/arj/patches/SBo_integrity_64bit.patch
+Forwarded: no
+Reviewed-By: Guillem Jover <guillem%debian.org@localhost>
+Last-Update: 2014-08-06
+
+--- arj_proc.c.orig    2022-01-08 14:35:06.610901643 +0000
++++ arj_proc.c
+@@ -586,7 +586,7 @@ int search_for_extension(char *name, cha
+ /* Returns the exact amount of data that could be safely written to the
+    destination volume */
+ 
+-unsigned long get_volfree(unsigned int increment)
++unsigned long get_volfree(unsigned long increment)
+ {
+  unsigned long pvol;
+  unsigned int arjsec_overhead;
+@@ -606,7 +606,7 @@ unsigned long get_volfree(unsigned int i
+  remain=volume_limit-ftell(aostream)-pvol-(long)arjsec_overhead-
+         (long)out_bytes-(long)cpos-(long)ext_voldata-
+         MULTIVOLUME_RESERVE-t_volume_offset;
+- return((unsigned long)min(remain, (unsigned long)increment));
++ return((unsigned long)min(remain, increment));
+ }
+ 
+ /* Performs various checks when multivolume data is packed to predict an
+@@ -2467,14 +2467,14 @@ static int get_str_from_jq()
+     *tsptr='\0';
+   endptr=tsptr;
+   tsptr=sptr;
+-  while((unsigned int)tsptr<(unsigned int)endptr&&patterns<SEARCH_STR_MAX)
++  while((intptr_t)tsptr<(intptr_t)endptr&&patterns<SEARCH_STR_MAX)
+   {
+    while(*tsptr=='\0')
+     tsptr++;
+-   if((unsigned int)tsptr<(unsigned int)endptr)
++   if((intptr_t)tsptr<(intptr_t)endptr)
+    {
+     search_str[patterns++]=tsptr;
+-    while(*tsptr!='\0'&&(unsigned int)tsptr<(unsigned int)endptr)
++    while(*tsptr!='\0'&&(intptr_t)tsptr<(intptr_t)endptr)
+      tsptr++;
+    }
+   }
+@@ -2899,12 +2899,12 @@ char *ltrim(char *str)
+ }
+ #endif
+ 
+-#if defined(WORDS_BIGENDIAN)&&!defined(ARJDISP)&&!defined(REGISTER)
++#if (defined(WORDS_BIGENDIAN) || defined(ALIGN_POINTERS)) && !defined(ARJDISP) && !defined(REGISTER)
+ /* Model-independent routine to get 2 bytes from far RAM */
+ 
+-unsigned int mget_word(char FAR *p)
++uint16_t mget_word(char FAR *p)
+ {
+- unsigned int b0, b1;
++ uint16_t b0, b1;
+ 
+  b0=mget_byte(p);
+  b1=mget_byte(p+1);
+@@ -2913,9 +2913,9 @@ unsigned int mget_word(char FAR *p)
+ 
+ /* Model-independent routine to get 4 bytes from far RAM */
+ 
+-unsigned long mget_dword(char FAR *p)
++uint32_t mget_dword(char FAR *p)
+ {
+- unsigned long w0, w1;
++ uint32_t w0, w1;
+ 
+  w0=mget_word(p);
+  w1=mget_word(p+2);
+@@ -2924,7 +2924,7 @@ unsigned long mget_dword(char FAR *p)
+ 
+ /* Model-independent routine to store 2 bytes in far RAM */
+ 
+-void mput_word(unsigned int w, char FAR *p)
++void mput_word(uint16_t w, char FAR *p)
+ {
+  mput_byte(w&0xFF, p);
+  mput_byte(w>>8  , p+1);
+@@ -2932,7 +2932,7 @@ void mput_word(unsigned int w, char FAR 
+ 
+ /* Model-independent routine to store 4 bytes in far RAM */
+ 
+-void mput_dword(unsigned long d, char FAR *p)
++void mput_dword(uint32_t d, char FAR *p)
+ {
+  mput_word(d&0xFFFF, p);
+  mput_word(d>>16   , p+2);
diff -r e471a174a6f4 -r a911a7b43b03 archivers/arj/patches/patch-arj__proc.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/archivers/arj/patches/patch-arj__proc.h   Sat Jan 08 14:43:09 2022 +0000
@@ -0,0 +1,71 @@
+$NetBSD: patch-arj__proc.h,v 1.1 2022/01/08 14:43:09 tnn Exp $
+
+debian/001_arches_align.patch
+Description: Correct build failure on ia64 due to unaligned memory access.
+Author: Guillem Jover <guillem%debian.org@localhost>
+Origin: vendor
+Forwarded: no
+Last-Update: 2008-06-16
+
+
+debian/003_64_bit_clean.patch
+Description: Make code 64-bit clean.
+Author: Guillem Jover <guillem%debian.org@localhost>
+Origin: vendor
+Bug-Debian: https://bugs.debian.org/339815
+Forwarded: no
+Last-Update: 2005-11-24
+
+--- arj_proc.h.orig    2022-01-08 14:35:15.711534423 +0000
++++ arj_proc.h
+@@ -8,15 +8,17 @@
+ #ifndef ARJ_PROC_INCLUDED
+ #define ARJ_PROC_INCLUDED
+ 
++#include <stdint.h>
++
+ /* Helper macros */
+ 
+-#define mget_byte(p) (*(unsigned char FAR *)(p)&0xFF)
+-#define mput_byte(c, p) *(unsigned char FAR *)(p)=(unsigned char)(c)
+-#ifndef WORDS_BIGENDIAN
+-#define mget_word(p) (*(unsigned short *)(p)&0xFFFF)
+-#define mput_word(w,p) (*(unsigned short *)(p)=(unsigned short)(w))
+-#define mget_dword(p) (*(unsigned long *)(p))
+-#define mput_dword(w,p) (*(unsigned long *)(p)=(unsigned long)(w))
++#define mget_byte(p) (*(uint8_t FAR *)(p)&0xFF)
++#define mput_byte(c, p) *(uint8_t FAR *)(p)=(uint8_t)(c)
++#if !defined(ALIGN_POINTERS) && !defined(WORDS_BIGENDIAN)
++#define mget_word(p) (*(uint16_t *)(p)&0xFFFF)
++#define mput_word(w,p) (*(uint16_t *)(p)=(uint16_t)(w))
++#define mget_dword(p) (*(uint32_t *)(p))
++#define mput_dword(w,p) (*(uint32_t *)(p)=(uint32_t)(w))
+ #endif
+ 
+ /* Prototypes */
+@@ -31,7 +33,7 @@ void copy_bytes(unsigned long nbytes);
+ int translate_path(char *name);
+ void restart_proc(char *dest);
+ int search_for_extension(char *name, char *ext_list);
+-unsigned long get_volfree(unsigned int increment);
++unsigned long get_volfree(unsigned long increment);
+ unsigned int check_multivolume(unsigned int increment);
+ void store();
+ void hollow_encode();
+@@ -60,11 +62,11 @@ void pack_mem(struct mempack *mempack);



Home | Main Index | Thread Index | Old Index