oeps… unbreak 32-bit array indicēs (or rather, wrap of negative indicēs

into the positive high range) on 64-bit platforms: just always wrap and
ignore the result, remove the nonsensical out-of-range check
This commit is contained in:
tg 2007-10-25 16:10:16 +00:00
parent 98f0a3c101
commit 7c0db962eb
1 changed files with 2 additions and 3 deletions

5
var.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.49 2007/10/25 15:23:10 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.50 2007/10/25 16:10:16 tg Exp $");
/*
* Variables
@ -135,8 +135,7 @@ array_index_calc(const char *n, bool *arrayp, uint32_t *valp)
afree(tmp, ATEMP);
n = str_nsave(n, p - n, ATEMP);
evaluate(sub, &rval, KSH_UNWIND_ERROR, true);
if ((long)(*valp = (uint32_t)rval) != rval)
errorf("%s: subscript %ld out of range", n, rval);
*valp = (uint32_t)rval;
afree(sub, ATEMP);
}
return n;