From 71e5708f15455a9cff62a291f9682642e1e291a5 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Mon, 9 Dec 2013 15:07:31 -0800 Subject: [PATCH] Check for an empty string before dereferencing the first character of the string. No bug, rs=till --HG-- extra : rebase_source : e4b408f772aa2460db920871086faa37c04356bb --- js/src/jsinferinlines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index 429aed30eb8..5ff7c870e9c 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -223,7 +223,7 @@ IdToTypeId(jsid id) if (JSID_IS_STRING(id)) { JSFlatString *str = JSID_TO_FLAT_STRING(id); JS::TwoByteChars cp = str->range(); - if (JS7_ISDEC(cp[0]) || cp[0] == '-') { + if (cp.length() > 0 && (JS7_ISDEC(cp[0]) || cp[0] == '-')) { for (size_t i = 1; i < cp.length(); ++i) { if (!JS7_ISDEC(cp[i])) return id;