diff options
author | Zach van Rijn <me@zv.io> | 2023-09-16 23:09:52 -0500 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2023-09-16 23:09:58 -0500 |
commit | 7a30d67a3a456bd33eb27e4fb82bf9477467e3e9 (patch) | |
tree | 5ee324430a8f9cc048e301a76b8a3dda871bb32c /user/yasm/fix-pmmx.patch | |
parent | 199a04c1b0229d494c5f61e00e900745862c3f82 (diff) | |
download | packages-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/yasm/fix-pmmx.patch')
-rw-r--r-- | user/yasm/fix-pmmx.patch | 91 |
1 files changed, 91 insertions, 0 deletions
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; |