ref: 9ed091470480513808c8f1cdb2707b2ceb501c90
parent: a9e6b4cd017e594964a56c2294875c4240b1ead8
author: Tor Andersson <tor.andersson@artifex.com>
date: Wed Nov 5 12:35:51 EST 2014
Fix bug in js_setlength when used for relative indices.
--- a/jsarray.c
+++ b/jsarray.c
@@ -14,7 +14,7 @@
void js_setlength(js_State *J, int idx, unsigned int len)
{
js_pushnumber(J, len);
- js_setproperty(J, idx, "length");
+ js_setproperty(J, idx < 0 ? idx - 1: idx, "length");
}
int js_hasindex(js_State *J, int idx, unsigned int i)