summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-07-23 09:30:15 +0100
committerPeter Stephenson <pws@zsh.org>2015-07-23 09:31:12 +0100
commit9a82a8675782f137c8739bc950ac86dfe6a8dfd1 (patch)
treef5dc107d9be8a0716df4888d9c7b11fb6984c879
parent346fcf9b96c7b52df9a9d9a4a453aa1bb35808fb (diff)
downloadzsh-9a82a8675782f137c8739bc950ac86dfe6a8dfd1.tar.gz
zsh-9a82a8675782f137c8739bc950ac86dfe6a8dfd1.tar.xz
zsh-9a82a8675782f137c8739bc950ac86dfe6a8dfd1.zip
35793: avoid undefined behaviour shifting signed number
-rw-r--r--ChangeLog5
-rw-r--r--Src/zsh.h7
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 69a78b16d..5036ea9ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-23  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 35793: Src/zsh.h: avoid undefined behaviour shifting signed
+	number.
+
 2015-07-23  Oliver Kiddle <opk@zsh.org>
 
 	* 35753: Completion/Zsh/Type/_ps1234: allow for numbers after
diff --git a/Src/zsh.h b/Src/zsh.h
index 69fef33f5..a99c90065 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1752,9 +1752,10 @@ struct tieddata {
 				  * necessarily want to match multiple
 				  * elements
 				  */
-#define SCANPM_ISVAR_AT   ((-1)<<15)	/* "$foo[@]"-style substitution
-					 * Only sign bit is significant
-					 */
+/* "$foo[@]"-style substitution
+ * Only sign bit is significant
+ */
+#define SCANPM_ISVAR_AT   ((int)(((unsigned int)-1)<<15))
 
 /*
  * Flags for doing matches inside parameter substitutions, i.e.