diff options
author | A. Wilcox <awilfox@adelielinux.org> | 2024-09-14 19:00:22 +1000 |
---|---|---|
committer | Horst Burkhardt <horst@adelielinux.org> | 2024-09-14 19:00:22 +1000 |
commit | fda89243252aef2b663417a165e1fbe2f7c97f68 (patch) | |
tree | a113bb45972257f21de5a1cfec5a6d2f1fadac56 | |
parent | 31e36491183d4144751ff4fe666c5994eed143e8 (diff) | |
download | packages-fda89243252aef2b663417a165e1fbe2f7c97f68.tar.gz packages-fda89243252aef2b663417a165e1fbe2f7c97f68.tar.bz2 packages-fda89243252aef2b663417a165e1fbe2f7c97f68.tar.xz packages-fda89243252aef2b663417a165e1fbe2f7c97f68.zip |
bootstrap/jamvm-1.5.1: actually add that sanitisation patch
Signed-off-by: Horst Burkhardt <horst@adelielinux.org>
-rw-r--r-- | bootstrap/jamvm-1.5.1/jamvm-1.5.1-san-fixes.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/bootstrap/jamvm-1.5.1/jamvm-1.5.1-san-fixes.patch b/bootstrap/jamvm-1.5.1/jamvm-1.5.1-san-fixes.patch new file mode 100644 index 000000000..c251fb80f --- /dev/null +++ b/bootstrap/jamvm-1.5.1/jamvm-1.5.1-san-fixes.patch @@ -0,0 +1,52 @@ +Fixes issues caught by ASan and UBSan. + +diff -ur jamvm-1.5.1-old/src/alloc.c jamvm-1.5.1/src/alloc.c +--- jamvm-1.5.1-old/src/alloc.c 2008-02-21 19:57:42.000000000 -0600 ++++ jamvm-1.5.1/src/alloc.c 2024-09-12 13:51:52.050426782 -0500 +@@ -69,8 +69,8 @@ + /* Bits used within the chunk header (see also alloc.h) */ + #define ALLOC_BIT 1 + #define SPECIAL_BIT 4 +-#define HAS_HASHCODE_BIT (1<<31) +-#define HASHCODE_TAKEN_BIT (1<<30) ++#define HAS_HASHCODE_BIT (1u<<31) ++#define HASHCODE_TAKEN_BIT (1u<<30) + + #define HDR_FLAGS_MASK ~(ALLOC_BIT|FLC_BIT|SPECIAL_BIT| \ + HAS_HASHCODE_BIT|HASHCODE_TAKEN_BIT) +diff -ur jamvm-1.5.1-old/src/class.c jamvm-1.5.1/src/class.c +--- jamvm-1.5.1-old/src/class.c 2008-03-07 19:22:34.000000000 -0600 ++++ jamvm-1.5.1/src/class.c 2024-09-12 13:44:19.108561458 -0500 +@@ -603,7 +603,7 @@ + if(classname[1] == 'L') { + char element_name[len-2]; + +- strcpy(element_name, classname + 2); ++ strncpy(element_name, classname + 2, len-3); + element_name[len-3] = '\0'; + classblock->element_class = findClassFromClassLoader(element_name, class_loader); + } else +diff -ur jamvm-1.5.1-old/src/class.h jamvm-1.5.1/src/class.h +--- jamvm-1.5.1-old/src/class.h 2024-09-12 14:29:40.379457916 -0500 ++++ jamvm-1.5.1/src/class.h 2024-09-12 13:53:46.438270697 -0500 +@@ -25,7 +25,7 @@ + + #define READ_U1(v,p,l) v = *(p)++ + #define READ_U2(v,p,l) v = ((p)[0]<<8)|(p)[1]; (p)+=2 +-#define READ_U4(v,p,l) v = ((p)[0]<<24)|((p)[1]<<16)|((p)[2]<<8)|(p)[3]; (p)+=4 ++#define READ_U4(v,p,l) v = ((u4)(p)[0]<<24)|((u4)(p)[1]<<16)|((u4)(p)[2]<<8)|(u4)(p)[3]; (p)+=4 + #define READ_U8(v,p,l) v = ((u8)(p)[0]<<56)|((u8)(p)[1]<<48)|((u8)(p)[2]<<40) \ + |((u8)(p)[3]<<32)|((u8)(p)[4]<<24)|((u8)(p)[5]<<16) \ + |((u8)(p)[6]<<8)|(u8)(p)[7]; (p)+=8 +diff -ur jamvm-1.5.1-old/src/lock.c jamvm-1.5.1/src/lock.c +--- jamvm-1.5.1-old/src/lock.c 2008-03-06 04:42:14.000000000 -0600 ++++ jamvm-1.5.1/src/lock.c 2024-09-12 14:26:11.631626642 -0500 +@@ -75,7 +75,7 @@ + + #define TID_SHIFT (COUNT_SIZE+COUNT_SHIFT) + #define TID_SIZE (32-TID_SHIFT) +-#define TID_MASK (((1<<TID_SIZE)-1)<<TID_SHIFT) ++#define TID_MASK (((1u<<TID_SIZE)-1)<<TID_SHIFT) + + #define SCAVENGE(ptr) \ + ({ \ |