zsh-workers
 help / color / mirror / code / Atom feed
From: Michael Hwang <michael.a.hwang@gmail.com>
To: zsh-workers@zsh.org
Cc: Michael Hwang <michael.a.hwang@gmail.com>
Subject: [PATCH] Removed arbitrary limitations on array accesses
Date: Mon,  4 Jan 2010 20:38:17 -0500	[thread overview]
Message-ID: <1262655497-21263-1-git-send-email-michael.a.hwang@gmail.com> (raw)
In-Reply-To: <y>

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


             reply	other threads:[~2010-01-05  1:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05  1:38 Michael Hwang [this message]
2010-01-05  9:48 ` Peter Stephenson
2010-01-05 15:32   ` Bart Schaefer
2010-01-05 15:43     ` Mikael Magnusson
2010-01-05 20:48     ` Geoff Wing
2010-01-06 13:42   ` Duncan Sinclair
2010-01-06 14:02     ` Mikael Magnusson
2010-01-06 17:03       ` Richard Hartmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1262655497-21263-1-git-send-email-michael.a.hwang@gmail.com \
    --to=michael.a.hwang@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).