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:
5
var.c
5
var.c
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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
|
* Variables
|
||||||
@@ -135,8 +135,7 @@ array_index_calc(const char *n, bool *arrayp, uint32_t *valp)
|
|||||||
afree(tmp, ATEMP);
|
afree(tmp, ATEMP);
|
||||||
n = str_nsave(n, p - n, ATEMP);
|
n = str_nsave(n, p - n, ATEMP);
|
||||||
evaluate(sub, &rval, KSH_UNWIND_ERROR, true);
|
evaluate(sub, &rval, KSH_UNWIND_ERROR, true);
|
||||||
if ((long)(*valp = (uint32_t)rval) != rval)
|
*valp = (uint32_t)rval;
|
||||||
errorf("%s: subscript %ld out of range", n, rval);
|
|
||||||
afree(sub, ATEMP);
|
afree(sub, ATEMP);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
|
Reference in New Issue
Block a user