diff options
Diffstat (limited to 'archivers')
-rw-r--r-- | archivers/arj/Makefile | 6 | ||||
-rw-r--r-- | archivers/arj/distinfo | 9 | ||||
-rw-r--r-- | archivers/arj/patches/patch-arj__arcv.c | 70 | ||||
-rw-r--r-- | archivers/arj/patches/patch-arj__proc.c | 110 | ||||
-rw-r--r-- | archivers/arj/patches/patch-arj__proc.h | 71 | ||||
-rw-r--r-- | archivers/arj/patches/patch-arjtypes.c | 73 | ||||
-rw-r--r-- | archivers/arj/patches/patch-decode.c | 35 | ||||
-rw-r--r-- | archivers/arj/patches/patch-postproc.c | 31 |
8 files changed, 397 insertions, 8 deletions
diff --git a/archivers/arj/Makefile b/archivers/arj/Makefile index 21248686035..908d2001751 100644 --- a/archivers/arj/Makefile +++ b/archivers/arj/Makefile @@ -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 @@ pre-configure: INSTALLATION_DIRS+= ${ARJ_DOCSDIR} -BROKEN_ON_PLATFORM= ${LP64PLATFORMS} - post-install: ${INSTALL_DATA} ${WRKSRC}/doc/COPYING ${WRKSRC}/doc/debug.txt \ ${DESTDIR}${ARJ_DOCSDIR} diff --git a/archivers/arj/distinfo b/archivers/arj/distinfo index 7736f909348..3b7bc84a712 100644 --- a/archivers/arj/distinfo +++ b/archivers/arj/distinfo @@ -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_configure.in) = 062f3dc1eee6f009dfdfa432bb3c138a9c28a829 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 --git a/archivers/arj/patches/patch-arj__arcv.c b/archivers/arj/patches/patch-arj__arcv.c new file mode 100644 index 00000000000..1e8ce0f812f --- /dev/null +++ b/archivers/arj/patches/patch-arj__arcv.c @@ -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> +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 --git a/archivers/arj/patches/patch-arj__proc.c b/archivers/arj/patches/patch-arj__proc.c new file mode 100644 index 00000000000..4268b24c2a1 --- /dev/null +++ b/archivers/arj/patches/patch-arj__proc.c @@ -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> +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> +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> +Origin: other, http://slackbuilds.org/cgit/slackbuilds/tree/system/arj/patches/SBo_integrity_64bit.patch +Forwarded: no +Reviewed-By: Guillem Jover <guillem@debian.org> +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 --git a/archivers/arj/patches/patch-arj__proc.h b/archivers/arj/patches/patch-arj__proc.h new file mode 100644 index 00000000000..8485a86d0b5 --- /dev/null +++ b/archivers/arj/patches/patch-arj__proc.h @@ -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> +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> +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); + void unpack_mem(struct mempack *mempack); + void strip_lf(char *str); + char *ltrim(char *str); +-#ifdef WORDS_BIGENDIAN +-unsigned int mget_word(char FAR *p); +-unsigned long mget_dword(char FAR *p); +-void mput_word(unsigned int w, char FAR *p); +-void mput_dword(unsigned long d, char FAR *p); ++#if defined(ALIGN_POINTERS) || defined(WORDS_BIGENDIAN) ++uint16_t mget_word(char FAR *p); ++uint32_t mget_dword(char FAR *p); ++void mput_word(uint16_t w, char FAR *p); ++void mput_dword(uint32_t d, char FAR *p); + #endif + + #endif diff --git a/archivers/arj/patches/patch-arjtypes.c b/archivers/arj/patches/patch-arjtypes.c new file mode 100644 index 00000000000..83608e3987e --- /dev/null +++ b/archivers/arj/patches/patch-arjtypes.c @@ -0,0 +1,73 @@ +$NetBSD: patch-arjtypes.c,v 1.1 2022/01/08 14:43:09 tnn Exp $ + +Description: Use proper time_t type instead of unsigned long for variables + that are being passed to localhost() and gmtime(). This fixes several + segfaults on x32. +Author: Guillem Jover <guillem@debian.org> +Origin: vendor +Forwarded: no +Last-Update: 2019-08-11 + +--- arjtypes.c.orig 2005-06-23 10:00:54.000000000 +0000 ++++ arjtypes.c +@@ -135,11 +135,11 @@ static int isleapyear(int year) + + /* Converts a UNIX timestamp to the DOS style */ + +-static unsigned long ts_unix2dos(const long ts) ++static unsigned long ts_unix2dos(time_t ts) + { + struct tm *stm; + +- stm=arj_localtime((time_t*)&ts); ++ stm=arj_localtime(&ts); + return(get_tstamp(stm->tm_year+1900, stm->tm_mon+1, stm->tm_mday, + stm->tm_hour, stm->tm_min, stm->tm_sec)); + } +@@ -148,14 +148,14 @@ static unsigned long ts_unix2dos(const l + + static unsigned long mk_unixtime(int y, int m, int d, int hh, int mm, int ss) + { +- unsigned long u=0, ts; ++ unsigned long u=0; + unsigned int i, v; + /* Clash with NetBSD/x86-64 patch: leaving rc as unsigned long still permits + to escape the year 2038 problem in favor of year 2106 problem, while a + dedicated time_t structure can be expected as a 64-bit value on relevant + platforms -- ASR fix 25/01/2004 */ +- unsigned long rc; +- time_t tt; ++ time_t rc; ++ time_t tt, ts; + long tzshift, shiftd1, shiftd2; + struct tm *stm; + +@@ -191,7 +191,7 @@ static unsigned long mk_unixtime(int y, + u+=isleapyear(y); + } + rc=86400*(unsigned long)(u+d-1)+(unsigned long)hh*3600+(unsigned long)mm*60+(unsigned long)ss; +- stm=arj_localtime((const long *)&rc); ++ stm=arj_localtime(&rc); + debug_assert(stm!=NULL); /* LIBCS.DLL returns NULL for unixtime beyond + 0x7FFFFFFF */ + tzshift=(long)stm->tm_hour*3600+(long)stm->tm_min*60; +@@ -203,7 +203,7 @@ static unsigned long mk_unixtime(int y, + debug_assert(stm!=NULL); + stm->tm_year+=v; + #else +- stm=gmtime((const long *)&ts); ++ stm=gmtime(&ts); + #endif + shiftd2=stm->tm_mday; + /* Local time overruns GMT, add 24 hours for safety */ +@@ -304,8 +304,9 @@ void make_timestamp(struct timestamp *de + void timestamp_to_str(char *str, struct timestamp *ts) + { + struct tm *stm; ++ time_t ut = ts->unixtime; + +- stm=arj_localtime((time_t *)&ts->unixtime); ++ stm=arj_localtime(&ut); + /* Workaround for a MS C v 7.0 CRT bug */ + #if TARGET==DOS&&COMPILER==MSC&&_MSC_VER==700 + if(stm->tm_year<70) /* 31 -> 101 */ diff --git a/archivers/arj/patches/patch-decode.c b/archivers/arj/patches/patch-decode.c index f2232a9921a..cb1455918e4 100644 --- a/archivers/arj/patches/patch-decode.c +++ b/archivers/arj/patches/patch-decode.c @@ -1,8 +1,10 @@ -$NetBSD: patch-decode.c,v 1.1 2015/04/12 15:54:02 tnn Exp $ +$NetBSD: patch-decode.c,v 1.2 2022/01/08 14:43:09 tnn Exp $ Fix CVE-2015-2782. Via Debian security-afl.patch. ---- decode.c.orig 2003-04-12 16:15:58.000000000 +0000 +Fix out-of-bounds read via Debian out-of-bounds-read.patch. + +--- decode.c.orig 2022-01-08 14:27:21.037706349 +0000 +++ decode.c @@ -255,7 +255,7 @@ void read_pt_len(int nn, int nbit, int i if(i==i_special) @@ -26,3 +28,32 @@ Fix CVE-2015-2782. Via Debian security-afl.patch. c_len[i++]=(unsigned char)(c-2); } while(i<NC) +@@ -416,10 +416,10 @@ static void NEAR decode_end() + + void decode(int action) + { +- short i; +- short r; +- short c; +- static short j; ++ int i; ++ int r; ++ int c; ++ static int j; + + #if SFX_LEVEL>=ARJSFXV + if(!setjmp(decode_proc)) +@@ -450,9 +450,12 @@ void decode(int action) + { + j=c-(UCHAR_MAX+1-THRESHOLD); + count-=(unsigned long)j; +- i=r-decode_p()-1; ++ int P = decode_p(); ++ i=r-P-1; + if(i<0) + i+=DICSIZ; ++ if(i<0) ++ goto termination; + if(r>i&&r<DICSIZ-MAXMATCH-1) + { + while(--j>=0) diff --git a/archivers/arj/patches/patch-postproc.c b/archivers/arj/patches/patch-postproc.c new file mode 100644 index 00000000000..552778a7e4c --- /dev/null +++ b/archivers/arj/patches/patch-postproc.c @@ -0,0 +1,31 @@ +$NetBSD: patch-postproc.c,v 1.1 2022/01/08 14:43:09 tnn Exp $ + +debian/self_integrity_64bit.patch +Description: Fix arj self-integrity check on 64-bit systems +Author: B Watson <yalhcru@gmail.com> +Origin: other, http://slackbuilds.org/cgit/slackbuilds/tree/system/arj/patches/SBo_integrity_64bit.patch +Forwarded: no +Reviewed-By: Guillem Jover <guillem@debian.org> +Last-Update: 2014-08-06 + +--- postproc.c.orig 2003-06-22 11:12:28.000000000 +0000 ++++ postproc.c +@@ -6,6 +6,7 @@ + * + */ + ++#include <stdint.h> + #include "arj.h" + + /* Operations */ +@@ -37,8 +38,9 @@ static unsigned short self_check[]={0x90 + + static char buf[PROC_BLOCK_SIZE]; + +-static void _fput_dword(const unsigned long l, FILE *stream) ++static void _fput_dword(const unsigned long w, FILE *stream) + { ++ uint32_t l = (uint32_t)w; + #ifdef WORDS_BIGENDIAN + fputc(l ,stream); + fputc(l>>8 ,stream); |