summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2023-09-16 23:09:52 -0500
committerZach van Rijn <me@zv.io>2023-09-16 23:09:58 -0500
commit7a30d67a3a456bd33eb27e4fb82bf9477467e3e9 (patch)
tree5ee324430a8f9cc048e301a76b8a3dda871bb32c /user
parent199a04c1b0229d494c5f61e00e900745862c3f82 (diff)
downloadpackages-7a30d67a3a456bd33eb27e4fb82bf9477467e3e9.tar.gz
packages-7a30d67a3a456bd33eb27e4fb82bf9477467e3e9.tar.bz2
packages-7a30d67a3a456bd33eb27e4fb82bf9477467e3e9.tar.xz
packages-7a30d67a3a456bd33eb27e4fb82bf9477467e3e9.zip
user/yasm: add patch for pmmx. fixes #1056.
Diffstat (limited to 'user')
-rw-r--r--user/yasm/APKBUILD11
-rw-r--r--user/yasm/fix-pmmx.patch91
2 files changed, 98 insertions, 4 deletions
diff --git a/user/yasm/APKBUILD b/user/yasm/APKBUILD
index 3faa73264..aa20160a9 100644
--- a/user/yasm/APKBUILD
+++ b/user/yasm/APKBUILD
@@ -1,7 +1,7 @@
-# Maintainer:
+# Maintainer: Zach van Rijn <me@zv.io>
pkgname=yasm
pkgver=1.3.0
-pkgrel=2
+pkgrel=3
pkgdesc="A rewrite of NASM to allow for multiple syntax supported (NASM, TASM, GAS, etc.)"
url="http://yasm.tortall.net/"
arch="all"
@@ -9,7 +9,9 @@ license="(BSD-2-Clause OR BSD-3-Clause) AND (Artistic-1.0 OR GPL-2.0-only OR LGP
depends=""
makedepends=""
subpackages="$pkgname-dev $pkgname-doc"
-source="http://www.tortall.net/projects/$pkgname/releases/$pkgname-$pkgver.tar.gz"
+source="http://www.tortall.net/projects/$pkgname/releases/$pkgname-$pkgver.tar.gz
+ fix-pmmx.patch
+ "
prepare() {
default_prepare
@@ -33,4 +35,5 @@ package() {
install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}
-sha512sums="572d3b45568b10f58e48f1188c2d6bcbdd16429c8afaccc8c6d37859b45635e106885d679e41d0bee78c23822108c7ae75aa7475eed5ba58057e0a6fe1b68645 yasm-1.3.0.tar.gz"
+sha512sums="572d3b45568b10f58e48f1188c2d6bcbdd16429c8afaccc8c6d37859b45635e106885d679e41d0bee78c23822108c7ae75aa7475eed5ba58057e0a6fe1b68645 yasm-1.3.0.tar.gz
+3d88d39dd4d5315cdbe7fd7f2da682eefd186e5e6ee740436d90167f12defa08d4785eb0b48af82464d0beb1b382c47413f033caabd942285833310f80b3482a fix-pmmx.patch"
diff --git a/user/yasm/fix-pmmx.patch b/user/yasm/fix-pmmx.patch
new file mode 100644
index 000000000..f8032dcb2
--- /dev/null
+++ b/user/yasm/fix-pmmx.patch
@@ -0,0 +1,91 @@
+From afbff931d56c467791b0347c784ebc4a7c73014d Mon Sep 17 00:00:00 2001
+From: cryptobro <andrey.roussev@gmail.com>
+Date: Tue, 12 Oct 2021 12:29:10 +0300
+Subject: [PATCH] Fix UB/crashes
+
+Sometimes you may encounter strange errors like:
+libvgstr3412_x64_asm.s:4473: error: Unrecognized register name `%ym'
+libvgstr3412_x64_asm.s:4473: error: expected `,'
+make[2]: *** [Makefile:576: libvgstr3412_la-libvgstr3412_x64_asm.lo] Error 1g
+
+Valgrind shows the places:
+valgrind /tmp/yasm-1.3.0/yasm -e -p gnu -f elf64 -DPROC_TYPE_X64 -DELF libvgstr3412_x64_asm.s -DPIC -o xxxx
+==8224== Memcheck, a memory error detector
+==8224== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
+==8224== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
+==8224== Command: /tmp/yasm-1.3.0/yasm -e -p gnu -f elf64 -DPROC_TYPE_X64 -DELF libvgstr3412_x64_asm.s -DPIC -o xxxx
+==8224==
+==8224== Invalid read of size 1
+==8224== at 0x4846C70: strncmp (vg_replace_strmem.c:663)
+==8224== by 0x43125C: expand_macro (gas-preproc.c:915)
+==8224== by 0x43125C: process_line (gas-preproc.c:1174)
+==8224== by 0x4317A2: gas_preproc_get_line (gas-preproc.c:1336)
+==8224== by 0x402A13: do_preproc_only (yasm.c:323)
+==8224== by 0x402A13: main (yasm.c:724)
+==8224== Address 0x4fa7330 is 0 bytes inside a block of size 4 free'd
+==8224== at 0x48430E4: free (vg_replace_malloc.c:755)
+==8224== by 0x43151D: expand_macro (gas-preproc.c:936)
+==8224== by 0x43151D: process_line (gas-preproc.c:1174)
+==8224== by 0x4317A2: gas_preproc_get_line (gas-preproc.c:1336)
+==8224== by 0x402A13: do_preproc_only (yasm.c:323)
+==8224== by 0x402A13: main (yasm.c:724)
+==8224== Block was alloc'd at
+==8224== at 0x48456AF: realloc (vg_replace_malloc.c:1192)
+==8224== by 0x414887: def_xrealloc (xmalloc.c:101)
+==8224== by 0x42F1A7: gas_scan (gas-preproc.c:440)
+==8224== by 0x4311FF: expand_macro (gas-preproc.c:906)
+==8224== by 0x4311FF: process_line (gas-preproc.c:1174)
+==8224== by 0x4317A2: gas_preproc_get_line (gas-preproc.c:1336)
+==8224== by 0x402A13: do_preproc_only (yasm.c:323)
+==8224== by 0x402A13: main (yasm.c:724)
+==8224==
+==8224== Invalid read of size 1
+==8224== at 0x431268: expand_macro (gas-preproc.c:916)
+==8224== by 0x431268: process_line (gas-preproc.c:1174)
+==8224== by 0x4317A2: gas_preproc_get_line (gas-preproc.c:1336)
+==8224== by 0x402A13: do_preproc_only (yasm.c:323)
+==8224== by 0x402A13: main (yasm.c:724)
+==8224== Address 0x56c5581 is 1 bytes inside a block of size 13 free'd
+==8224== at 0x48430E4: free (vg_replace_malloc.c:755)
+==8224== by 0x43151D: expand_macro (gas-preproc.c:936)
+==8224== by 0x43151D: process_line (gas-preproc.c:1174)
+==8224== by 0x4317A2: gas_preproc_get_line (gas-preproc.c:1336)
+==8224== by 0x402A13: do_preproc_only (yasm.c:323)
+==8224== by 0x402A13: main (yasm.c:724)
+==8224== Block was alloc'd at
+==8224== at 0x48456AF: realloc (vg_replace_malloc.c:1192)
+==8224== by 0x414887: def_xrealloc (xmalloc.c:101)
+==8224== by 0x42F1A7: gas_scan (gas-preproc.c:440)
+==8224== by 0x4311FF: expand_macro (gas-preproc.c:906)
+==8224== by 0x4311FF: process_line (gas-preproc.c:1174)
+==8224== by 0x4317A2: gas_preproc_get_line (gas-preproc.c:1336)
+==8224== by 0x402A13: do_preproc_only (yasm.c:323)
+==8224== by 0x402A13: main (yasm.c:724)
+---
+ modules/preprocs/gas/gas-preproc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/modules/preprocs/gas/gas-preproc.c b/modules/preprocs/gas/gas-preproc.c
+index 94d8f5da3..8f4c79323 100644
+--- a/modules/preprocs/gas/gas-preproc.c
++++ b/modules/preprocs/gas/gas-preproc.c
+@@ -912,6 +912,9 @@ static void expand_macro(yasm_preproc_gas *pp, macro_entry *macro, const char *a
+ char *end = strstr(macro->params[j], "=");
+ int len = (end ? (size_t)(end - macro->params[j])
+ : strlen(macro->params[j]));
++ if (!tokval.t_charptr) {
++ continue;
++ }
+ if (!strncmp(tokval.t_charptr, macro->params[j], len)
+ && tokval.t_charptr[len] == '\0') {
+ /* now, find matching argument. */
+@@ -932,6 +935,9 @@ static void expand_macro(yasm_preproc_gas *pp, macro_entry *macro, const char *a
+ memcpy(line + cursor - len, value, value_length);
+ pp->expr.string = work = line;
+ pp->expr.string_cursor += delta;
++ if (pp->expr.symbol == tokval.t_charptr) {
++ tokval.t_charptr = NULL;
++ }
+ if (pp->expr.symbol) {
+ yasm_xfree(pp->expr.symbol);
+ pp->expr.symbol = NULL;