diff options
-rw-r--r-- | main/busybox/0018-ash-fix-ifs-cleanup-on-error-paths.patch | 91 | ||||
-rw-r--r-- | main/busybox/APKBUILD | 4 |
2 files changed, 94 insertions, 1 deletions
diff --git a/main/busybox/0018-ash-fix-ifs-cleanup-on-error-paths.patch b/main/busybox/0018-ash-fix-ifs-cleanup-on-error-paths.patch new file mode 100644 index 00000000000..c09bc84daa6 --- /dev/null +++ b/main/busybox/0018-ash-fix-ifs-cleanup-on-error-paths.patch @@ -0,0 +1,91 @@ +From 1c5455284234e894dfb6086bf7f3e9a6d5d9611f Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko <vda.linux@googlemail.com> +Date: Tue, 2 Aug 2022 11:13:44 +0200 +Subject: [PATCH] ash: fix ifs cleanup on error paths + +Patch by Alex Gorinson <algore3698@gmail.com> + +function old new delta +evalvar 477 495 +18 +varvalue 603 618 +15 +subevalvar 1557 1572 +15 +------------------------------------------------------------------------------ +(add/remove: 0/0 grow/shrink: 3/0 up/down: 48/0) Total: 48 bytes + +Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> +--- + shell/ash.c | 2 ++ + shell/ash_test/ash-heredoc/heredoc_and_cmd.right | 2 ++ + shell/ash_test/ash-heredoc/heredoc_and_cmd.tests | 8 ++++++++ + shell/hush_test/hush-heredoc/heredoc_and_cmd.right | 2 ++ + shell/hush_test/hush-heredoc/heredoc_and_cmd.tests | 8 ++++++++ + 5 files changed, 22 insertions(+) + create mode 100644 shell/ash_test/ash-heredoc/heredoc_and_cmd.right + create mode 100755 shell/ash_test/ash-heredoc/heredoc_and_cmd.tests + create mode 100644 shell/hush_test/hush-heredoc/heredoc_and_cmd.right + create mode 100755 shell/hush_test/hush-heredoc/heredoc_and_cmd.tests + +diff --git a/shell/ash.c b/shell/ash.c +index d29de37b7..c731a333b 100644 +--- a/shell/ash.c ++++ b/shell/ash.c +@@ -7028,6 +7028,7 @@ varunset(const char *end, const char *var, const char *umsg, int varflags) + msg = umsg; + } + } ++ ifsfree(); + ash_msg_and_raise_error("%.*s: %s%s", (int)(end - var - 1), var, msg, tail); + } + +@@ -7453,6 +7454,7 @@ varvalue(char *name, int varflags, int flags, int quoted) + if (discard) + return -1; + ++ ifsfree(); + raise_error_syntax("bad substitution"); + } + +diff --git a/shell/ash_test/ash-heredoc/heredoc_and_cmd.right b/shell/ash_test/ash-heredoc/heredoc_and_cmd.right +new file mode 100644 +index 000000000..25ae70561 +--- /dev/null ++++ b/shell/ash_test/ash-heredoc/heredoc_and_cmd.right +@@ -0,0 +1,2 @@ ++./heredoc_and_cmd.tests: line 4: D: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ++Y +diff --git a/shell/ash_test/ash-heredoc/heredoc_and_cmd.tests b/shell/ash_test/ash-heredoc/heredoc_and_cmd.tests +new file mode 100755 +index 000000000..197542de7 +--- /dev/null ++++ b/shell/ash_test/ash-heredoc/heredoc_and_cmd.tests +@@ -0,0 +1,8 @@ ++# The bug was only happening with <<REDIR;CMD form below: ++M='AAAAAAAAAAAAAAAAA' ++fff(){ ++date <<000; echo Y ++${D?$M$M$M$M$M$M} ++000 ++} ++fff +diff --git a/shell/hush_test/hush-heredoc/heredoc_and_cmd.right b/shell/hush_test/hush-heredoc/heredoc_and_cmd.right +new file mode 100644 +index 000000000..5c19a0621 +--- /dev/null ++++ b/shell/hush_test/hush-heredoc/heredoc_and_cmd.right +@@ -0,0 +1,2 @@ ++hush: D: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ++Y +diff --git a/shell/hush_test/hush-heredoc/heredoc_and_cmd.tests b/shell/hush_test/hush-heredoc/heredoc_and_cmd.tests +new file mode 100755 +index 000000000..197542de7 +--- /dev/null ++++ b/shell/hush_test/hush-heredoc/heredoc_and_cmd.tests +@@ -0,0 +1,8 @@ ++# The bug was only happening with <<REDIR;CMD form below: ++M='AAAAAAAAAAAAAAAAA' ++fff(){ ++date <<000; echo Y ++${D?$M$M$M$M$M$M} ++000 ++} ++fff diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD index 472ca2476f4..e247cc13fa8 100644 --- a/main/busybox/APKBUILD +++ b/main/busybox/APKBUILD @@ -5,7 +5,7 @@ # Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net> pkgname=busybox pkgver=1.35.0 -pkgrel=24 +pkgrel=25 pkgdesc="Size optimized toolbox of many common UNIX utilities" url="https://busybox.net/" arch="all" @@ -66,6 +66,7 @@ source="https://busybox.net/downloads/busybox-$pkgver.tar.bz2 0015-ed-don-t-use-memcpy-with-overlapping-memory-regions.patch 0016-ash-don-t-read-past-end-of-var-in-subvareval-for-bas.patch 0017-ash-Fix-use-after-free-on-idx-variable.patch + 0018-ash-fix-ifs-cleanup-on-error-paths.patch 0001-ash-add-built-in-BB_ASH_VERSION-variable.patch @@ -383,6 +384,7 @@ ecbe5c890d966f09280c7eb534109f785c68e292765f17ed7ff62fcc61d20f61443c4155add0a1eb 0040800382a6e3adcc6a8094b821488c7e297fc80304afba23a4fca43b7b26ac699378dfbd930ebbf9985336b3e431301f7ca93e2d041a071902a48740d263ef 0015-ed-don-t-use-memcpy-with-overlapping-memory-regions.patch 4c95dc4bf6aff9018bfb52b400f6d8375a1d22493b44ea516cb12dba6556f12797a3cba55768d2e59ff57c0f3247ec1ff95edb8f17561f3d37ec18d83ca47eb0 0016-ash-don-t-read-past-end-of-var-in-subvareval-for-bas.patch ccdf098fb15eaa316708181469a1193d6eec7067131e7b7645e0219bf03cfd07f4f79e8f62c1e560f6146dcc38186a29bdee08aaa39f290e11d020b8f07d2f65 0017-ash-Fix-use-after-free-on-idx-variable.patch +3abdbd25f1f0daa24b0aabe92880c28dc2d3b59eb29fad357dfaf2b78bb895466bbf4495e2185370d9219d65b22e65e525769e369e50fb1fdfd71b5229a4f429 0018-ash-fix-ifs-cleanup-on-error-paths.patch 6d100fe44da2b97c2cbdda253d0504b487212d195144d9315cddbe8c51d18fae3745701923b170b40e35f54b592f94f02cadbffd9cb716661c12a7f1da022763 0001-ash-add-built-in-BB_ASH_VERSION-variable.patch e33dbc27d77c4636f4852d5d5216ef60a9a4343484e4559e391c13c813bf65c782b889914eff2e1f038d74cf02cb0d23824ebbb1044b5f8c86260d5a1bbc4e4d 0001-pgrep-add-support-for-matching-against-UID-and-RUID.patch 7608fbb9deddc9268ba53bc5b762a00fa16744d595f6f8a2f5a857339e754ea0c3da084a1e48269c8281553e9171d2bb29b8530fbe85e6a934f97c3cfcdbe31b 0001-avoid-redefined-warnings-when-building-with-utmps.patch |