ref: 34cb61711fe29934dfa82ab55ea59ed85ae62642
parent: cbdf814ee25841ce2130e6d58b0ac607b508f045
author: Tor Andersson <[email protected]>
date: Tue May 29 10:29:16 EDT 2018
Fix 699383: Sorting arrays with zero or negative length.
--- a/jsarray.c
+++ b/jsarray.c
@@ -291,6 +291,10 @@
int i, n, len;
len = js_getlength(J, 0);
+ if (len <= 0) {
+ js_copy(J, 0);
+ return;
+ }
array = js_malloc(J, len * sizeof *array);
if (js_try(J)) {