summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2019-12-18 10:51:59 +0000
committerPeter Stephenson <p.stephenson@samsung.com>2019-12-18 10:51:59 +0000
commitfd068221b7fbbcfe89ec74c7eeb0138e90e14b13 (patch)
tree545c04f2ae2071ec7559b10993ef66ceaabae6d5
parenta90e93f454c62c7aa5227459a5bbe4ff5eeed78b (diff)
downloadzsh-fd068221b7fbbcfe89ec74c7eeb0138e90e14b13.tar.gz
zsh-fd068221b7fbbcfe89ec74c7eeb0138e90e14b13.tar.xz
zsh-fd068221b7fbbcfe89ec74c7eeb0138e90e14b13.zip
45083: Add signal protection to execarith().
Otherwise we could get re-entrancy in memory functions when
setting variables.
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index cc0ad1d8e..897114d3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-18  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 45083: Src/exec.c: execarith() needs signal protection as
+	it sets variables.
+
 2019-12-18  Daniel Shahaf  <danielsh@apache.org>
 
 	* 45076: Src/loop.c: internal: Simplify handling of
diff --git a/Src/exec.c b/Src/exec.c
index 50027654a..fac095d64 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5101,6 +5101,7 @@ execarith(Estate state, UNUSED(int do_exec))
     mnumber val = zero_mnumber;
     int htok = 0;
 
+    queue_signals();
     if (isset(XTRACE)) {
 	printprompt4();
 	fprintf(xtrerr, "((");
@@ -5120,6 +5121,8 @@ execarith(Estate state, UNUSED(int do_exec))
 	fprintf(xtrerr, " ))\n");
 	fflush(xtrerr);
     }
+    unqueue_signals();
+
     if (errflag) {
 	errflag &= ~ERRFLAG_ERROR;
 	return 2;