From e3f04e7f96b4f2852ca270b07f48690787a20252 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 30 Jan 2020 12:46:51 +0100 Subject: [PATCH] Check for empty string in js_isarrayindex. --- jsrun.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jsrun.c b/jsrun.c index 5e70684..b77e641 100644 --- a/jsrun.c +++ b/jsrun.c @@ -445,6 +445,10 @@ int js_isarrayindex(js_State *J, const char *p, int *idx) { int n = 0; + /* check for empty string */ + if (p[0] == 0) + return 0; + /* check for '0' and integers with leading zero */ if (p[0] == '0') return (p[1] == 0) ? *idx = 0, 1 : 0;