Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Removed arbitrary limitations on array accesses



This issue was brought up on IRC. It appears that while there is no limit on
how many array elements can be stored, there is a limit to how many can be
accessed. This patch removes these limits.

Michael Hwang

---
 Src/params.c |   16 ----------------
 Src/zsh.h    |    2 --
 2 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/Src/params.c b/Src/params.c
index 0425e07..d092ccc 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1853,22 +1853,6 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
     if (!bracks && *s)
 	return NULL;
     *pptr = s;
-    if (v->start > MAX_ARRLEN) {
-	zerr("subscript too %s: %d", "big", v->start + !isset(KSHARRAYS));
-	return NULL;
-    }
-    if (v->start < -MAX_ARRLEN) {
-	zerr("subscript too %s: %d", "small", v->start);
-	return NULL;
-    }
-    if (v->end > MAX_ARRLEN+1) {
-	zerr("subscript too %s: %d", "big", v->end - !!isset(KSHARRAYS));
-	return NULL;
-    }
-    if (v->end < -MAX_ARRLEN) {
-	zerr("subscript too %s: %d", "small", v->end);
-	return NULL;
-    }
     return v;
 }
 
diff --git a/Src/zsh.h b/Src/zsh.h
index 060f8a6..1b407b0 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -626,8 +626,6 @@ enum {
     VALFLAG_SUBST =     0x0004  /* Substitution, so apply padding, case flags */
 };
 
-#define MAX_ARRLEN    262144
-
 /********************************************/
 /* Definitions for word code                 */
 /********************************************/
-- 
1.6.2.5



Messages sorted by: Reverse Date, Date, Thread, Author